Skip to content

Commit 2f9e1c5

Browse files
Fix src and tests
1 parent edb3df8 commit 2f9e1c5

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lambdas/api-handler/src/handlers/__tests__/get-letters.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { helloWorld } from '../../index';
1+
import { getLetters } from '../../index';
22
import type { Context } from 'aws-lambda';
33
import { mockDeep } from 'jest-mock-extended';
44

55
describe('API Lambda handler', () => {
66
it('returns 200 OK with "Here are some letters: [L1, L2, L3]" for the root path', async () => {
7-
const event = { path: '/' };
7+
const event = { path: '/letters' };
88
const context = mockDeep<Context>();
99
const callback = jest.fn();
10-
const result = await helloWorld(event, context, callback);
10+
const result = await getLetters(event, context, callback);
1111

1212
expect(result).toEqual({
1313
statusCode: 200,
@@ -19,7 +19,7 @@ describe('API Lambda handler', () => {
1919
const event = { path: '/unknown' };
2020
const context = mockDeep<Context>();
2121
const callback = jest.fn();
22-
const result = await helloWorld(event, context, callback);
22+
const result = await getLetters(event, context, callback);
2323

2424
expect(result).toEqual({
2525
statusCode: 404,

lambdas/api-handler/src/handlers/get-letters.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
import { Handler, APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
33

44
export const getLetters: Handler = async (event: APIGatewayProxyEvent): Promise<APIGatewayProxyResult> => {
5-
const path = event.path || '/';
65

7-
if (path === '/') {
6+
if (event.path === '/letters') {
87
return {
98
statusCode: 200,
109
body: 'Here are some letters: [L1, L2, L3]',

0 commit comments

Comments
 (0)