@@ -19,9 +19,12 @@ awsMock.setSDK(path.resolve('node_modules/aws-sdk'))
1919const { mockClient } = require ( 'aws-sdk-client-mock' )
2020const {
2121 LambdaClient,
22+ CreateEventSourceMappingCommand,
2223 CreateFunctionCommand,
23- ListEventSourceMappingsCommand ,
24+ DeleteEventSourceMappingCommand ,
2425 GetFunctionCommand,
26+ ListEventSourceMappingsCommand,
27+ UpdateEventSourceMappingCommand,
2528 UpdateFunctionCodeCommand,
2629 UpdateFunctionConfigurationCommand
2730} = require ( '@aws-sdk/client-lambda' )
@@ -172,11 +175,14 @@ describe('lib/main', function () {
172175
173176 // for sdk v3
174177 mockLambdaClient . reset ( )
178+ mockLambdaClient . on ( CreateEventSourceMappingCommand ) . resolves ( lambdaMockSettings . createEventSourceMapping )
175179 mockLambdaClient . on ( CreateFunctionCommand ) . resolves ( lambdaMockSettings . createFunction )
180+ mockLambdaClient . on ( DeleteEventSourceMappingCommand ) . resolves ( lambdaMockSettings . deleteEventSourceMapping )
176181 mockLambdaClient . on ( GetFunctionCommand ) . resolves ( lambdaMockSettings . getFunction )
182+ mockLambdaClient . on ( ListEventSourceMappingsCommand ) . resolves ( lambdaMockSettings . listEventSourceMappings )
183+ mockLambdaClient . on ( UpdateEventSourceMappingCommand ) . resolves ( lambdaMockSettings . updateEventSourceMapping )
177184 mockLambdaClient . on ( UpdateFunctionCodeCommand ) . resolves ( lambdaMockSettings . updateFunctionCode )
178185 mockLambdaClient . on ( UpdateFunctionConfigurationCommand ) . resolves ( lambdaMockSettings . updateFunctionConfiguration )
179- mockLambdaClient . on ( ListEventSourceMappingsCommand ) . resolves ( lambdaMockSettings . listEventSourceMappings )
180186 } )
181187 after ( ( ) => {
182188 _awsRestore ( )
@@ -1424,7 +1430,7 @@ describe('lib/main', function () {
14241430 program . eventSourceFile = ''
14251431 const eventSourceList = lambda . _eventSourceList ( program )
14261432 return lambda . _updateEventSources (
1427- awsLambda ,
1433+ lambdaClient ,
14281434 '' ,
14291435 [ ] ,
14301436 eventSourceList . EventSourceMappings
@@ -1437,7 +1443,7 @@ describe('lib/main', function () {
14371443 program . eventSourceFile = 'event_sources.json'
14381444 const eventSourceList = lambda . _eventSourceList ( program )
14391445 return lambda . _updateEventSources (
1440- awsLambda ,
1446+ lambdaClient ,
14411447 'functionName' ,
14421448 [ ] ,
14431449 eventSourceList . EventSourceMappings
@@ -1448,7 +1454,7 @@ describe('lib/main', function () {
14481454
14491455 it ( 'simple test with mock (In case of deletion)' , ( ) => {
14501456 return lambda . _updateEventSources (
1451- awsLambda ,
1457+ lambdaClient ,
14521458 'functionName' ,
14531459 lambdaMockSettings . listEventSourceMappings . EventSourceMappings ,
14541460 { }
@@ -1461,7 +1467,7 @@ describe('lib/main', function () {
14611467 program . eventSourceFile = 'event_sources.json'
14621468 const eventSourceList = lambda . _eventSourceList ( program )
14631469 return lambda . _updateEventSources (
1464- awsLambda ,
1470+ lambdaClient ,
14651471 'functionName' ,
14661472 lambdaMockSettings . listEventSourceMappings . EventSourceMappings ,
14671473 eventSourceList . EventSourceMappings
0 commit comments