Skip to content

Commit 6275eab

Browse files
CCM-10591: Lambda Boilerplate
1 parent 8f87826 commit 6275eab

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed
Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
1-
// Replace me with the actual tests for your Lambda function
1+
import { handler } from '../index';
2+
3+
describe('event-logging Lambda', () => {
4+
let logSpy: jest.SpyInstance;
5+
6+
beforeAll(() => {
7+
logSpy = jest.spyOn(console, 'log').mockImplementation(() => {});
8+
});
9+
10+
afterEach(() => {
11+
logSpy.mockClear();
12+
});
13+
14+
afterAll(() => {
15+
logSpy.mockRestore();
16+
});
17+
18+
it('logs the input event and returns 200', async () => {
19+
const event = { foo: 'bar' };
20+
const result = await handler(event, {} as any, () => undefined);
21+
22+
expect(logSpy).toHaveBeenCalledWith('Received event:', event);
23+
expect(result).toEqual({
24+
statusCode: 200,
25+
body: 'Event logged',
26+
});
27+
});
28+
});

lambdas/example-lambda/src/jest.config.js

Whitespace-only changes.

0 commit comments

Comments
 (0)