-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Utilise
supertest
pour tester le serveur Express
... car lors de notre phase de test, un problème de concurrence entre les tests se pose. Notre implémentation ne permettait pas d'avoir plusieurs instances d'Express en parallèle. Le `fetch` d'un test A tapait le serveur d'un test B. `Supertest` semble être fait pour gérer ce genre de problème.
- Loading branch information
1 parent
c44012f
commit 61ac2b2
Showing
5 changed files
with
25 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
export const POST = async (path: string, body: object) => | ||
await fetch(`http://localhost:1234${path}`, { | ||
method: "POST", | ||
headers: { | ||
Accept: "application/json", | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify(body), | ||
}); | ||
import * as request from "supertest"; | ||
import { Express } from "express"; | ||
|
||
export const POST = async (app: Express, path: string, body: object) => | ||
await request(app).post(path).send(body).set("Accept", "application/json"); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.