Skip to content

Commit 3110da0

Browse files
committed
Add additional tests on pagination typing
1 parent 399e09e commit 3110da0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/search.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ describe.each([
9595
expect(response).toHaveProperty('processingTimeMs', expect.any(Number))
9696
expect(response).toHaveProperty('query', 'prince')
9797
expect(response.hits.length).toEqual(2)
98+
// @ts-expect-error Not present in the SearchResponse type because neither `page` or `hitsPerPage` is provided in the search params.
99+
expect(response.hitsPerPage).toBeUndefined()
100+
// @ts-expect-error Not present in the SearchResponse type because neither `page` or `hitsPerPage` is provided in the search params.
101+
expect(response.page).toBeUndefined()
102+
// @ts-expect-error Not present in the SearchResponse type because neither `page` or `hitsPerPage` is provided in the search params.
103+
expect(response.totalPages).toBeUndefined()
104+
// @ts-expect-error Not present in the SearchResponse type because neither `page` or `hitsPerPage` is provided in the search params.
105+
expect(response.totalHits).toBeUndefined()
98106
})
99107

100108
test(`${permission} key: Basic phrase search with matchingStrategy at ALL`, async () => {
@@ -255,6 +263,14 @@ describe.each([
255263
expect(response).toHaveProperty('processingTimeMs', expect.any(Number))
256264
expect(response).toHaveProperty('query', 'prince')
257265
expect(response.hits.length).toEqual(1)
266+
// @ts-expect-error Not present in the SearchResponse type because neither `page` or `hitsPerPage` is provided in the search params.
267+
expect(response.hitsPerPage).toBeUndefined()
268+
// @ts-expect-error Not present in the SearchResponse type because neither `page` or `hitsPerPage` is provided in the search params.
269+
expect(response.page).toBeUndefined()
270+
// @ts-expect-error Not present in the SearchResponse type because neither `page` or `hitsPerPage` is provided in the search params.
271+
expect(response.totalPages).toBeUndefined()
272+
// @ts-expect-error Not present in the SearchResponse type because neither `page` or `hitsPerPage` is provided in the search params.
273+
expect(response.totalHits).toBeUndefined()
258274
})
259275

260276
test(`${permission} key: search with matches parameter and small croplength`, async () => {
@@ -557,6 +573,12 @@ describe.each([
557573
expect(response.page).toEqual(1)
558574
expect(response.totalPages).toEqual(0)
559575
expect(response.totalHits).toEqual(7)
576+
// @ts-expect-error Not present in the SearchResponse type because `page` and/or `hitsPerPage` is provided in the search params.
577+
expect(response.limit).toBeUndefined()
578+
// @ts-expect-error Not present in the SearchResponse type because `page` and/or `hitsPerPage` is provided in the search params.
579+
expect(response.offset).toBeUndefined()
580+
// @ts-expect-error Not present in the SearchResponse type because `page` and/or `hitsPerPage` is provided in the search params.
581+
expect(response.estimatedTotalHits).toBeUndefined()
560582
})
561583

562584
test(`${permission} key: search with pagination parameters: hitsPerPage at 1 and page at 0`, async () => {

0 commit comments

Comments
 (0)