Skip to content

Instantly share code, notes, and snippets.

@maatthc
Created July 24, 2020 06:45
Show Gist options
  • Save maatthc/bb927efbd868d80e2ece40528a2211db to your computer and use it in GitHub Desktop.
Save maatthc/bb927efbd868d80e2ece40528a2211db to your computer and use it in GitHub Desktop.
How to easily mock multiple AWS services using Jest - JavaScript
jest.mock('aws-sdk', () => {
return {
SSM: jest.fn(() => ({
getParameter: jest.fn(() => ({
promise: jest.fn().mockResolvedValue({ Parameter: { Value: 'SECRET-KEY' } }),
})),
})),
SQS: jest.fn(() => ({})),
S3: jest.fn(() => ({})),
SNS: jest.fn(() => ({})),
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment