Skip to content

Commit e12fe9c

Browse files
committed
test: add coverage to parameters
1 parent 2c979f0 commit e12fe9c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/unit/workspaces.test.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,24 @@ const http = clientConstructor({
1212
})
1313
const workspacesRequest = workspaces(http)
1414

15-
1615
test(`Get workspaces has the correct path`, () => {
1716
workspacesRequest.list()
1817
expect(fetch.mock.calls[0][0]).toBe(`${API_BASE_URL}/workspaces`)
1918
})
2019

20+
test(`Get workspaces has the correct query parameters`, () => {
21+
workspacesRequest.list({
22+
search: 'hola',
23+
page: 2,
24+
pageSize: 10
25+
})
26+
27+
const params = new URL(fetch.mock.calls[0][0]).searchParams
28+
expect(params.get('search')).toBe('hola')
29+
expect(params.get('page')).toBe('2')
30+
expect(params.get('page_size')).toBe('10')
31+
})
32+
2133
test(`Get specific workscape has the correct path and method`, () => {
2234
workspacesRequest.get({ id: 2 })
2335
expect(fetch.mock.calls[0][1].method).toBe(`get`)

0 commit comments

Comments
 (0)