@@ -3,7 +3,7 @@ import { APIGatewayEvent, Context } from 'aws-lambda';
33import { mocked } from 'jest-mock' ;
44import { WorkflowJobEvent } from '@octokit/webhooks-types' ;
55
6- import { dispatchToRunners , eventBridgeWebhook , githubWebhook } from './lambda' ;
6+ import { dispatchToRunners , eventBridgeWebhook , directWebhook } from './lambda' ;
77import { handle , publishOnEventBridge } from './webhook' ;
88import ValidationError from './ValidationError' ;
99import { getParameter } from '@aws-github-runner/aws-ssm-util' ;
@@ -98,23 +98,23 @@ describe('Test webhook lambda wrapper.', () => {
9898 } ) ;
9999 } ) ;
100100
101- const result = await githubWebhook ( event , context ) ;
101+ const result = await directWebhook ( event , context ) ;
102102 expect ( result ) . toEqual ( { body : 'test' , statusCode : 200 } ) ;
103103 } ) ;
104104
105105 it ( 'An expected error, resolve.' , async ( ) => {
106106 const mock = mocked ( handle ) ;
107107 mock . mockRejectedValue ( new ValidationError ( 400 , 'some error' ) ) ;
108108
109- const result = await githubWebhook ( event , context ) ;
109+ const result = await directWebhook ( event , context ) ;
110110 expect ( result ) . toMatchObject ( { body : 'some error' , statusCode : 400 } ) ;
111111 } ) ;
112112
113113 it ( 'Errors are not thrown.' , async ( ) => {
114114 const mock = mocked ( handle ) ;
115115 const logSpy = jest . spyOn ( logger , 'error' ) ;
116116 mock . mockRejectedValue ( new Error ( 'some error' ) ) ;
117- const result = await githubWebhook ( event , context ) ;
117+ const result = await directWebhook ( event , context ) ;
118118 expect ( result ) . toMatchObject ( { body : 'Check the Lambda logs for the error details.' , statusCode : 500 } ) ;
119119 expect ( logSpy ) . toHaveBeenCalledTimes ( 1 ) ;
120120 } ) ;
0 commit comments