diff --git a/src/routes/api/hello.ts b/src/routes/api/hello.ts index 0af227c..1f346be 100644 --- a/src/routes/api/hello.ts +++ b/src/routes/api/hello.ts @@ -3,14 +3,11 @@ import type { Context } from '@netlify/functions' /** * Says hello. * - * @param {Request} request HTTP request. - * @param {Context} context Netlify function context. - * @return {Response} HTTP response. + * @param {Request} _request HTTP request. + * @param {Context} _context Netlify function context. + * @return {Response} HTTP response. * @since unreleased */ -export default function hello(request: Request, context: Context): Response { - return new Response(JSON.stringify({ context, request }), { - status: 200, - statusText: 'OK', - }) +export default function hello(_request: Request, _context: Context): Response { + return new Response('Hello, world!', { status: 200, statusText: 'OK' }) } diff --git a/tests/unit/routes/api/hello.test.ts b/tests/unit/routes/api/hello.test.ts index 7a3bb9f..0d92c17 100644 --- a/tests/unit/routes/api/hello.test.ts +++ b/tests/unit/routes/api/hello.test.ts @@ -8,4 +8,9 @@ describe('GET /api/hello', () => { it('should return a 200 status code', () => expect(hello({} as Request, {} as Context).status).toBe(200)) + + it('should return response text of "Hello, world!"', async () => + expect(await hello({} as Request, {} as Context).text()).toBe( + 'Hello, world!', + )) })