1.0.6 • Published 3 years ago

@homeservenow/serverless-event-mocks v1.0.6

Weekly downloads
14
License
MIT
Repository
github
Last release
3 years ago

@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

1.0.6

3 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago