39 lines
942 B
TypeScript
Raw Normal View History

2024-05-03 17:09:34 +02:00
import request from "supertest";
import app from "../src/app";
import { Server, IncomingMessage, ServerResponse } from "http";
const port = 3000;
let serveur : Server<typeof IncomingMessage, typeof ServerResponse>
describe("Test the root path", () => {
beforeEach(() => {
serveur = app.listen(port, () =>{
console.log(`serveur running in ${port}`)
})
})
afterEach((done) => {
serveur.close(done)
})
test("It should response the GET method", done => {
request(app)
.get("/")
.then(response => {
expect(response.statusCode).toBe(200);
done();
});
});
test("It should response the GET method", done => {
request(app)
.get("/")
.then(response => {
console.log(response)
2024-05-03 17:18:18 +02:00
expect(response.text).toEqual("hello world from dev")
2024-05-03 17:09:34 +02:00
done();
});
});
});