@@ -7,7 +7,10 @@ import {
77import { HIGHLIGHT_PRE_TAG , HIGHLIGHT_POST_TAG } from '../../constants'
88
99type Movie = ( typeof MOVIES ) [ number ]
10+
1011const INDEX_NAME = 'movies'
12+ const FIRST_ITEM_ID = MOVIES [ 0 ] . id
13+ const SECOND_ITEM_ID = MOVIES [ 1 ] . id
1114
1215beforeAll ( async ( ) => {
1316 await meilisearchClient . deleteIndex ( INDEX_NAME )
@@ -31,27 +34,27 @@ describe('fetchMeilisearchResults', () => {
3134 ] ,
3235 } )
3336
34- expect ( results [ 0 ] . hits [ 0 ] . id ) . toEqual ( 2 )
35- expect ( results [ 0 ] . hits [ 1 ] . id ) . toEqual ( 5 )
37+ expect ( results [ 0 ] . hits [ 0 ] . id ) . toEqual ( FIRST_ITEM_ID )
38+ expect ( results [ 0 ] . hits [ 1 ] . id ) . toEqual ( SECOND_ITEM_ID )
3639 } )
3740
38- // test('with custom pagination', async () => {
39- // const results = await fetchMeilisearchResults({
40- // searchClient,
41- // queries: [
42- // {
43- // indexName: INDEX_NAME,
44- // query: 'Hit ',
45- // params: {
46- // hitsPerPage: 1,
47- // page: 1,
48- // },
49- // },
50- // ],
51- // })
41+ test ( 'with custom pagination' , async ( ) => {
42+ const results = await fetchMeilisearchResults ( {
43+ searchClient,
44+ queries : [
45+ {
46+ indexName : INDEX_NAME ,
47+ query : '' ,
48+ params : {
49+ hitsPerPage : 1 ,
50+ page : 1 , // pages start at 0
51+ } ,
52+ } ,
53+ ] ,
54+ } )
5255
53- // expect(results[0].hits[0].id).toEqual(2 )
54- // })
56+ expect ( results [ 0 ] . hits [ 0 ] . id ) . toEqual ( SECOND_ITEM_ID )
57+ } )
5558
5659 // test('with custom highlight tags', async () => {
5760 // const results = await fetchMeilisearchResults({
0 commit comments