test setup

This commit is contained in:
Aashish-Upadhyay-101
2023-03-16 17:34:11 +05:45
parent 3d818f953d
commit 46f2b7a3f8
4 changed files with 20 additions and 11 deletions

View File

@@ -0,0 +1,21 @@
import { Server } from 'http';
import main from '../src';
import { describe, expect, it, beforeAll, afterAll } from '@jest/globals';
import request from 'supertest';
let server: Server;
beforeAll(async () => {
server = await main;
});
afterAll(async () => {
server.close();
});
describe('Healthcheck endpoint', () => {
it('GET /healthcheck should return OK', async () => {
const res = await request(server).get('/healthcheck');
expect(res.status).toEqual(200);
});
});