From 04ca99afdb0e5aec84e0d8dbecf168da9caa2862 Mon Sep 17 00:00:00 2001 From: Clement Date: Sat, 18 May 2024 13:13:29 +0200 Subject: [PATCH] add error test case --- Express/barAndCafe/test/openTripMaps.test.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Express/barAndCafe/test/openTripMaps.test.ts b/Express/barAndCafe/test/openTripMaps.test.ts index 47fb28d..1f5c99c 100644 --- a/Express/barAndCafe/test/openTripMaps.test.ts +++ b/Express/barAndCafe/test/openTripMaps.test.ts @@ -74,7 +74,25 @@ describe("Test the otm city path", () => { }); }); - //TODO faire les test pour les cas d'erreur + test("It should response the 200 code for GET method (default radius)", done => { + request(app) + .get("/otm/radius") + .query({'lon':'-1.4344594', 'lat' : '46.6686478'}) + .then(response => { + expect(response.statusCode).toBe(200); + done(); + }); + }); + + test("It should response the 400 code for GET method (missing lon and lat)", done => { + request(app) + .get("/otm/radius") + .then(response => { + expect(response.statusCode).toBe(400); + done(); + }); + }); + test("Get bar in radius from API", done => { const out = {