Skip to content

Instantly share code, notes, and snippets.

@piclez
Created June 12, 2024 19:57
Show Gist options
  • Save piclez/f4b6cc0fb206649d24e915dfec1a6e7e to your computer and use it in GitHub Desktop.
Save piclez/f4b6cc0fb206649d24e915dfec1a6e7e to your computer and use it in GitHub Desktop.
Lambda Handler Test
const { handler } = require('./handler');
jest.mock("@sentry/node", () => ({
init: () => jest.fn(),
wrapHandler: () => jest.fn(),
}));
describe('handler', () => {
it('should return the correct response', async () => {
const event = {
input: {
error: {
Error: 'Exception Error',
}
}
};
const response = await handler(event);
expect(response).toBe(JSON.stringify('Exception Error'));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment