Clement adc63a097d
All checks were successful
Build Docker Image Front / run (push) Successful in 23s
Build Docker Image Back / run (push) Successful in 1m4s
Build Docker Image Front / run (pull_request) Successful in 22s
Build Docker Image Back / run (pull_request) Successful in 21s
JsDocs / coverage (pull_request) Successful in 33s
Test and coverage / coverage (pull_request) Successful in 35s
fix test
2024-05-06 19:44:15 +02:00

41 lines
1.0 KiB
TypeScript

import request from "supertest";
import app from "../src/app";
import { Server, IncomingMessage, ServerResponse } from "http";
import * as dotenv from "dotenv";
dotenv.config({path: '../../.env'})
const port = parseInt(process.env.BAR_PORT || '3000')
let serveur : Server<typeof IncomingMessage, typeof ServerResponse>
describe("Test the welcome 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("/welcome")
.then(response => {
expect(response.statusCode).toBe(200);
done();
});
});
test("It should response the GET method", done => {
const out = {hello:"world"};
request(app)
.get("/welcome")
.then(response => {
expect(response.text).toEqual(JSON.stringify(out))
done();
});
});
});