@homeservenow/serverless-event-mocks
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

@homeservenow/serverless-event-mocks

This library exposes mock event factories for use in lambda tests. Each one accepts a partial event and fills in the rest of it with sensible defaults.

Each event that takes a body will also helpfully stringify any objects you pass to it, so you don't need to repeat this logic all over the place in your tests.

Sample usage

const context = createMockContext();
const event = createMockAPIGatewayEvent({
  path: "/path",
  httpMethod: "post",
  pathParameters: { jobID: job.id },
});

const result = await handler(event, context);
expect(result.statusCode).toEqual(200);

Documentation

createMockContext

createMockAPIGatewayEvent

Readme

Keywords

none

Package Sidebar

Install

npm i @homeservenow/serverless-event-mocks

Weekly Downloads

89

Version

1.0.6

License

MIT

Unpacked Size

56.6 kB

Total Files

14

Last publish

Collaborators

  • homeservenow-engineering