At Mbanq we run most of our services on AWS and try to use AWS Lambda as much as possible.

Lately I’ve been working on the a small npm package that will help us make use of SSM and KMS to manage our system configuration. SSM and KMS play nicely together as the most of AWS services.

In order to test the newly written npm package, we had to mock the promisified version of the ssm.getParameters(request)

const AWS = require('aws-sdk')

const ssm = AWS.SSM({ region: 'eu-west-1 }) ssm.getParameters(request).promise() // we have to mock the response from this call

There are different ways of mocking the AWS. For example there is the aws-mock-sdk package from the very cool DWYL guys. I decide to go with pure Jest though.

Some things you have to take into account to make the SSM’s functionality testable: