I am trying to mock calls to CodePipeline.putJobSuccessResult in a Lambda. However, a real aws-sdk call is being made instead of invoking my stub. I am successfully able to mock out some other services such as DynamoDB and DocumentClient using the same technique, but not CodePipeline.
ValidationException: 1 validation error detected: Value at 'jobId' failed to satisfy constraint: Member must satisfy regular expression pattern: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
at Request.extractError (node_modules/aws-sdk/lib/protocol/json.js:51:27)
at Request.callListeners (node_modules/aws-sdk/lib/sequential_executor.js:106:20)
....
The stack trace shows that it is invoking the actual aws-sdk library, not the mock.
Summary
I am trying to mock calls to CodePipeline.putJobSuccessResult in a Lambda. However, a real aws-sdk call is being made instead of invoking my stub. I am successfully able to mock out some other services such as DynamoDB and DocumentClient using the same technique, but not CodePipeline.
Versions Jest: 24.7.1 aws-sdk: 2.447.0 aws-sdk-mock: 4.5.0
Example
my.js:
my.spec.js:
Result:
The stack trace shows that it is invoking the actual aws-sdk library, not the mock.