You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
612 B

import request from 'supertest';
import app, { startServer } from '../src/server';
import { Server, IncomingMessage, ServerResponse } from 'http';
describe('GET /api/endpoint', () => {
let server: Server<typeof IncomingMessage, typeof ServerResponse>;
const port = 3000
beforeAll(() => {
server = startServer(port);
});
afterAll((done) => {
server.close(done);
});
it('should return a 200 status code', async () => {
const response = await request(app).get('/');
expect(response.status).toBe(200);
});
// Ecrire d'autres tests ici
});