Skip to content

Commit 023e1c9

Browse files
committed
chore(SA-675): fix lint warnings in test files
- Remove unused slack import from index.spec.ts - Remove unused consoleSpy variable from slack.spec.ts - Add eslint-disable comments for necessary any types in test mocks
1 parent 9e4ae40 commit 023e1c9

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

tests/index.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ jest.mock('../src/github')
33
jest.mock('../src/slack')
44
import * as google from '../src/google'
55
import * as github from '../src/github'
6-
import * as slack from '../src/slack'
76
import * as mod from '../index'
87

98
let processExitSpy

tests/slack.spec.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ import * as mod from '../src/slack'
55
import { EventEmitter } from 'events'
66

77
describe('slack integration', () => {
8-
let consoleSpy: jest.SpyInstance
98
let consoleErrorSpy: jest.SpyInstance
109

1110
beforeEach(() => {
12-
consoleSpy = jest.spyOn(global.console, 'log').mockImplementation()
11+
jest.spyOn(global.console, 'log').mockImplementation()
1312
consoleErrorSpy = jest.spyOn(global.console, 'error').mockImplementation()
1413
})
1514

@@ -26,9 +25,11 @@ describe('slack integration', () => {
2625

2726
it('sends notification when webhook URL is configured', async () => {
2827
jest.spyOn(config, 'slackWebhookUrl', 'get').mockReturnValue('https://hooks.slack.com/services/test')
28+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2929
const mockReq = new EventEmitter() as any
3030
mockReq.write = jest.fn()
3131
mockReq.end = jest.fn()
32+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3233
const mockRes = new EventEmitter() as any
3334
mockRes.statusCode = 200
3435
;(https.request as jest.Mock).mockImplementation((options, callback) => {
@@ -41,9 +42,11 @@ describe('slack integration', () => {
4142

4243
it('returns false when request fails with non-200', async () => {
4344
jest.spyOn(config, 'slackWebhookUrl', 'get').mockReturnValue('https://hooks.slack.com/services/test')
45+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4446
const mockReq = new EventEmitter() as any
4547
mockReq.write = jest.fn()
4648
mockReq.end = jest.fn()
49+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4750
const mockRes = new EventEmitter() as any
4851
mockRes.statusCode = 500
4952
;(https.request as jest.Mock).mockImplementation((options, callback) => {
@@ -57,6 +60,7 @@ describe('slack integration', () => {
5760

5861
it('returns false when request errors', async () => {
5962
jest.spyOn(config, 'slackWebhookUrl', 'get').mockReturnValue('https://hooks.slack.com/services/test')
63+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6064
const mockReq = new EventEmitter() as any
6165
mockReq.write = jest.fn()
6266
mockReq.end = jest.fn()
@@ -98,14 +102,17 @@ describe('slack integration', () => {
98102
})
99103

100104
describe('notifySlack', () => {
105+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
101106
let mockReq: any
102107

103108
beforeEach(() => {
104109
jest.spyOn(config, 'slackWebhookUrl', 'get').mockReturnValue('https://hooks.slack.com/services/test')
105110
jest.spyOn(config, 'githubOrg', 'get').mockReturnValue('myorg')
111+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
106112
mockReq = new EventEmitter() as any
107113
mockReq.write = jest.fn()
108114
mockReq.end = jest.fn()
115+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
109116
const mockRes = new EventEmitter() as any
110117
mockRes.statusCode = 200
111118
;(https.request as jest.Mock).mockImplementation((options, callback) => {

0 commit comments

Comments
 (0)