From a05fb87f85c36eb5452e065ff3a6ea1df30936d2 Mon Sep 17 00:00:00 2001 From: Clement Date: Sat, 18 May 2024 13:04:12 +0200 Subject: [PATCH] add test for detaill POI --- Express/barAndCafe/test/openTripMaps.test.ts | 58 ++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/Express/barAndCafe/test/openTripMaps.test.ts b/Express/barAndCafe/test/openTripMaps.test.ts index 663ec95..47fb28d 100644 --- a/Express/barAndCafe/test/openTripMaps.test.ts +++ b/Express/barAndCafe/test/openTripMaps.test.ts @@ -108,4 +108,62 @@ describe("Test the otm city path", () => { }); }) + test("It should response the 200 code for GET method", done => { + request(app) + .get("/otm/poidetaill") + .query({'id':'562635'}) + .then(response => { + expect(response.statusCode).toBe(200); + done(); + }); + }); + + test("Get bar in radius from API", done => { + const out = { + "xid": "N4032296324", + "name": "Le 27 point carré", + "address": { + "road": "Rue Raymond Poincaré", + "town": "La Roche-sur-Yon", + "state": "Pays de la Loire", + "county": "La Roche-sur-Yon", + "suburb": "Zola", + "country": "France", + "postcode": "85000", + "country_code": "fr", + "house_number": "27", + "neighbourhood": "Cité des Forges" + }, + "rate": "1", + "osm": "node/4032296324", + "kinds": "foods,bars,tourist_facilities", + "sources": { + "geometry": "osm", + "attributes": [ + "osm" + ] + }, + "otm": "https://opentripmap.com/en/card/N4032296324", + "point": { + "lon": -1.4344594478607178, + "lat": 46.66864776611328 + } + } + request(app) + .get("/otm/poidetaill") + .query({'id':'562635'}) + .then(response => { + expect(response.text).toEqual(JSON.stringify(out)); + done(); + }); + }) + + test("It should response the 200 code for GET method", done => { + request(app) + .get("/otm/poidetaill") + .then(response => { + expect(response.statusCode).toBe(400); + done(); + }); + }); }); \ No newline at end of file