From bcbda09785ac685e49e9ceca3c812955d6142404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Bult=C3=A9?= Date: Tue, 21 Nov 2023 09:01:53 +0100 Subject: [PATCH] add test for _get --- src/services/api/__tests__/DatagouvfrAPI.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/services/api/__tests__/DatagouvfrAPI.test.js b/src/services/api/__tests__/DatagouvfrAPI.test.js index 412d14551..74d751de4 100644 --- a/src/services/api/__tests__/DatagouvfrAPI.test.js +++ b/src/services/api/__tests__/DatagouvfrAPI.test.js @@ -20,6 +20,7 @@ const endpoint = 'asdf' const noContent = uuid() const notFound = uuid() const networkError = uuid() +const entityId = uuid() const server = setupServer( http.delete(`${baseUrl}/${version}/${endpoint}/${noContent}/`, () => { @@ -36,6 +37,10 @@ const server = setupServer( http.get(`${baseUrl}/${version}/${endpoint}/`, () => { return HttpResponse.json([], { status: 200 }) + }), + + http.get(`${baseUrl}/${version}/${endpoint}/${entityId}/`, () => { + return HttpResponse.json({ id: entityId }, { status: 200 }) }) ) @@ -83,3 +88,8 @@ test('raw list', async ({ client }) => { const res = await client._list() expect(Array.isArray(res)).toBeTruthy() }) + +test('raw get', async ({ client }) => { + const res = await client._get(entityId) + expect(res.id).toEqual(entityId) +})