@@ -19,9 +19,12 @@ awsMock.setSDK(path.resolve('node_modules/aws-sdk'))
19
19
const { mockClient } = require ( 'aws-sdk-client-mock' )
20
20
const {
21
21
LambdaClient,
22
+ CreateEventSourceMappingCommand,
22
23
CreateFunctionCommand,
23
- ListEventSourceMappingsCommand ,
24
+ DeleteEventSourceMappingCommand ,
24
25
GetFunctionCommand,
26
+ ListEventSourceMappingsCommand,
27
+ UpdateEventSourceMappingCommand,
25
28
UpdateFunctionCodeCommand,
26
29
UpdateFunctionConfigurationCommand
27
30
} = require ( '@aws-sdk/client-lambda' )
@@ -172,11 +175,14 @@ describe('lib/main', function () {
172
175
173
176
// for sdk v3
174
177
mockLambdaClient . reset ( )
178
+ mockLambdaClient . on ( CreateEventSourceMappingCommand ) . resolves ( lambdaMockSettings . createEventSourceMapping )
175
179
mockLambdaClient . on ( CreateFunctionCommand ) . resolves ( lambdaMockSettings . createFunction )
180
+ mockLambdaClient . on ( DeleteEventSourceMappingCommand ) . resolves ( lambdaMockSettings . deleteEventSourceMapping )
176
181
mockLambdaClient . on ( GetFunctionCommand ) . resolves ( lambdaMockSettings . getFunction )
182
+ mockLambdaClient . on ( ListEventSourceMappingsCommand ) . resolves ( lambdaMockSettings . listEventSourceMappings )
183
+ mockLambdaClient . on ( UpdateEventSourceMappingCommand ) . resolves ( lambdaMockSettings . updateEventSourceMapping )
177
184
mockLambdaClient . on ( UpdateFunctionCodeCommand ) . resolves ( lambdaMockSettings . updateFunctionCode )
178
185
mockLambdaClient . on ( UpdateFunctionConfigurationCommand ) . resolves ( lambdaMockSettings . updateFunctionConfiguration )
179
- mockLambdaClient . on ( ListEventSourceMappingsCommand ) . resolves ( lambdaMockSettings . listEventSourceMappings )
180
186
} )
181
187
after ( ( ) => {
182
188
_awsRestore ( )
@@ -1424,7 +1430,7 @@ describe('lib/main', function () {
1424
1430
program . eventSourceFile = ''
1425
1431
const eventSourceList = lambda . _eventSourceList ( program )
1426
1432
return lambda . _updateEventSources (
1427
- awsLambda ,
1433
+ lambdaClient ,
1428
1434
'' ,
1429
1435
[ ] ,
1430
1436
eventSourceList . EventSourceMappings
@@ -1437,7 +1443,7 @@ describe('lib/main', function () {
1437
1443
program . eventSourceFile = 'event_sources.json'
1438
1444
const eventSourceList = lambda . _eventSourceList ( program )
1439
1445
return lambda . _updateEventSources (
1440
- awsLambda ,
1446
+ lambdaClient ,
1441
1447
'functionName' ,
1442
1448
[ ] ,
1443
1449
eventSourceList . EventSourceMappings
@@ -1448,7 +1454,7 @@ describe('lib/main', function () {
1448
1454
1449
1455
it ( 'simple test with mock (In case of deletion)' , ( ) => {
1450
1456
return lambda . _updateEventSources (
1451
- awsLambda ,
1457
+ lambdaClient ,
1452
1458
'functionName' ,
1453
1459
lambdaMockSettings . listEventSourceMappings . EventSourceMappings ,
1454
1460
{ }
@@ -1461,7 +1467,7 @@ describe('lib/main', function () {
1461
1467
program . eventSourceFile = 'event_sources.json'
1462
1468
const eventSourceList = lambda . _eventSourceList ( program )
1463
1469
return lambda . _updateEventSources (
1464
- awsLambda ,
1470
+ lambdaClient ,
1465
1471
'functionName' ,
1466
1472
lambdaMockSettings . listEventSourceMappings . EventSourceMappings ,
1467
1473
eventSourceList . EventSourceMappings
0 commit comments