@@ -3,7 +3,7 @@ import { Types } from 'mongoose';
33import { getLoggedInAgent , getServer } from '@/fixtures' ;
44import Alert from '@/models/alert' ;
55import Webhook , { WebhookService } from '@/models/webhook' ;
6- import * as template from '@/tasks/checkAlerts/template ' ;
6+ import * as transports from '@/tasks/checkAlerts/transports ' ;
77
88const MOCK_WEBHOOK = {
99 name : 'Test Webhook' ,
@@ -1221,10 +1221,10 @@ describe('webhooks router', () => {
12211221
12221222 beforeEach ( ( ) => {
12231223 genericSpy = jest
1224- . spyOn ( template , 'handleSendGenericWebhook' )
1224+ . spyOn ( transports , 'handleSendGenericWebhook' )
12251225 . mockResolvedValue ( undefined ) ;
12261226 slackSpy = jest
1227- . spyOn ( template , 'handleSendSlackWebhook' )
1227+ . spyOn ( transports , 'handleSendSlackWebhook' )
12281228 . mockResolvedValue ( undefined ) ;
12291229 } ) ;
12301230
@@ -1258,7 +1258,7 @@ describe('webhooks router', () => {
12581258
12591259 // The outbound call should receive the real URL and headers
12601260 expect ( genericSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1261- const sentWebhook = genericSpy . mock . calls [ 0 ] [ 0 ] ;
1261+ const sentWebhook = genericSpy . mock . calls [ 0 ] [ 0 ] . channel ;
12621262 expect ( sentWebhook . url ) . toBe ( realUrl ) ;
12631263 expect ( sentWebhook . headers . toJSON ( ) ) . toEqual ( {
12641264 Authorization : 'Bearer real-secret' ,
@@ -1289,7 +1289,7 @@ describe('webhooks router', () => {
12891289
12901290 // The outbound call should receive the attacker URL and literal ****
12911291 // (NOT the stored real secret)
1292- const sentWebhook = genericSpy . mock . calls [ 0 ] [ 0 ] ;
1292+ const sentWebhook = genericSpy . mock . calls [ 0 ] [ 0 ] . channel ;
12931293 expect ( sentWebhook . url ) . toBe ( 'https://attacker.example.com/capture' ) ;
12941294 expect ( sentWebhook . headers . toJSON ( ) ) . toEqual ( {
12951295 Authorization : '****' ,
@@ -1383,7 +1383,7 @@ describe('webhooks router', () => {
13831383 . expect ( 200 ) ;
13841384
13851385 expect ( genericSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1386- const sentWebhook = genericSpy . mock . calls [ 0 ] [ 0 ] ;
1386+ const sentWebhook = genericSpy . mock . calls [ 0 ] [ 0 ] . channel ;
13871387 expect ( sentWebhook . url ) . toBe ( 'https://example.com/webhook' ) ;
13881388 } ) ;
13891389
0 commit comments