Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for _get
Browse files Browse the repository at this point in the history
abulte committed Nov 21, 2023
1 parent c761944 commit bcbda09
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/services/api/__tests__/DatagouvfrAPI.test.js
Original file line number Diff line number Diff line change
@@ -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)
})

0 comments on commit bcbda09

Please sign in to comment.