Files
freeCodeCamp/api/index.test.ts
Tom 7aeb4ab76b feat(api): setup jest in new api (#49709)
* feat(api): setup jest in new api

* feat: sample tests
2023-03-16 20:33:40 +05:30

19 lines
421 B
TypeScript

import request, { Response } from 'supertest';
import { API_LOCATION as api } from './utils/env';
describe('GET /', () => {
let res: undefined | Response;
beforeAll(async () => {
res = await request(api).get('/');
});
test('have a 200 response', () => {
expect(res?.statusCode).toBe(200);
});
test('return { "hello": "world"}', () => {
expect(res?.body).toEqual({ hello: 'world' });
});
});