@@ -100,7 +100,7 @@ describe.each([
100100 await masterClient . index < Movie > ( index . uid ) . waitForPendingUpdate ( updateId )
101101 } )
102102
103- test ( `${ permission } key: Basic search` , async ( ) => {
103+ test ( `${ permission } key: ${ method } Basic search` , async ( ) => {
104104 await client
105105 . index < Movie > ( index . uid )
106106 . search ( 'prince' , { } , method )
@@ -116,7 +116,7 @@ describe.each([
116116 } )
117117 } )
118118
119- test ( `${ permission } key: Search with options` , async ( ) => {
119+ test ( `${ permission } key: ${ method } Search with options` , async ( ) => {
120120 await client
121121 . index < Movie > ( index . uid )
122122 . search ( 'prince' , { limit : 1 } , method )
@@ -132,7 +132,7 @@ describe.each([
132132 } )
133133 } )
134134
135- test ( `${ permission } key: Search with limit and offset` , async ( ) => {
135+ test ( `${ permission } key: ${ method } Search with limit and offset` , async ( ) => {
136136 await client
137137 . index < Movie > ( index . uid )
138138 . search (
@@ -163,7 +163,7 @@ describe.each([
163163 } )
164164 } )
165165
166- test ( `${ permission } key: Search with matches parameter and small croplength` , async ( ) => {
166+ test ( `${ permission } key: ${ method } Search with matches parameter and small croplength` , async ( ) => {
167167 await client
168168 . index < Movie > ( index . uid )
169169 . search (
@@ -186,15 +186,15 @@ describe.each([
186186 )
187187 expect ( response . query === 'prince' ) . toBeTruthy ( )
188188 expect ( response . hits [ 0 ] ?. _matchesInfo ?. comment ) . toEqual ( [
189- { start : 2 , length : 6 } ,
189+ { start : 22 , length : 6 } ,
190190 ] )
191191 expect ( response . hits [ 0 ] ?. _matchesInfo ?. title ) . toEqual ( [
192- { start : 0 , length : 6 } ,
192+ { start : 9 , length : 6 } ,
193193 ] )
194194 } )
195195 } )
196196
197- test ( `${ permission } key: Search with all options but not all fields` , async ( ) => {
197+ test ( `${ permission } key: ${ method } Search with all options but not all fields` , async ( ) => {
198198 await client
199199 . index < Movie > ( index . uid )
200200 . search (
@@ -226,17 +226,16 @@ describe.each([
226226 expect ( response . hits [ 0 ] . _formatted ?. id ) . toEqual ( 456 )
227227 expect ( response . hits [ 0 ] ) . not . toHaveProperty ( 'comment' )
228228 expect ( response . hits [ 0 ] ) . not . toHaveProperty ( 'description' )
229- expect ( response . hits [ 0 ] . _formatted ) . not . toHaveProperty ( 'comment' )
230- expect ( response . hits [ 0 ] . _formatted ) . not . toHaveProperty ( 'description' )
231- expect ( response . hits . length === 1 ) . toBeTruthy ( )
229+ expect ( response . hits [ 0 ] . _formatted ) . toHaveProperty ( 'comment' )
230+ expect ( response . hits . length ) . toBe ( 1 )
232231 expect ( response . hits [ 0 ] ) . toHaveProperty (
233232 '_matchesInfo' ,
234233 expect . any ( Object )
235234 )
236235 } )
237236 } )
238237
239- test ( `${ permission } key: Search with all options and all fields` , async ( ) => {
238+ test ( `${ permission } key: ${ method } Search with all options and all fields` , async ( ) => {
240239 await client
241240 . index < Movie > ( index . uid )
242241 . search (
@@ -263,19 +262,15 @@ describe.each([
263262 )
264263 expect ( response . query === 'prince' ) . toBeTruthy ( )
265264 expect ( response . hits [ 0 ] ?. title === 'Le Petit Prince' ) . toBeTruthy ( )
266- expect (
267- response . hits [ 0 ] ?. _matchesInfo ?. title ?. [ 0 ] ?. start === 6
268- ) . toBeTruthy ( )
269- expect (
270- response . hits [ 0 ] ?. _matchesInfo ?. title ?. [ 0 ] ?. length === 6
271- ) . toBeTruthy ( )
265+ expect ( response . hits [ 0 ] ?. _matchesInfo ?. title ?. [ 0 ] ?. start ) . toBe ( 9 )
266+ expect ( response . hits [ 0 ] ?. _matchesInfo ?. title ?. [ 0 ] ?. length ) . toBe ( 6 )
272267 expect (
273268 response . hits [ 0 ] ?. _formatted ?. title === 'Petit <em>Prince</em>'
274269 ) . toBeTruthy ( )
275270 } )
276271 } )
277272
278- test ( `${ permission } key: Search with all options but specific fields` , async ( ) => {
273+ test ( `${ permission } key: ${ method } Search with all options but specific fields` , async ( ) => {
279274 await client
280275 . index < Movie > ( index . uid )
281276 . search (
@@ -308,12 +303,8 @@ describe.each([
308303 // expect(response.hits[0].comment).toEqual('comment')
309304
310305 expect ( response . hits [ 0 ] ?. title === 'Le Petit Prince' ) . toBeTruthy ( )
311- expect (
312- response . hits [ 0 ] ?. _matchesInfo ?. title ?. [ 0 ] ?. start === 6
313- ) . toBeTruthy ( )
314- expect (
315- response . hits [ 0 ] ?. _matchesInfo ?. title ?. [ 0 ] ?. length === 6
316- ) . toBeTruthy ( )
306+ expect ( response . hits [ 0 ] ?. _matchesInfo ?. title ?. [ 0 ] ?. start ) . toBe ( 9 )
307+ expect ( response . hits [ 0 ] ?. _matchesInfo ?. title ?. [ 0 ] ?. length ) . toBe ( 6 )
317308 expect (
318309 response . hits [ 0 ] ?. _formatted ?. title === 'Petit <em>Prince</em>'
319310 ) . toBeTruthy ( )
@@ -325,38 +316,34 @@ describe.each([
325316 } )
326317 } )
327318
328- test ( `${ permission } key: Search with filter and facetsDistribution` , async ( ) => {
319+ test ( `${ permission } key: ${ method } Search with filter and facetsDistribution` , async ( ) => {
329320 await client
330321 . index < Movie > ( index . uid )
331322 . search (
332323 'a' ,
333324 {
334- filter : [ 'genreromance ' ] ,
325+ filter : [ 'genre=romance ' ] ,
335326 facetsDistribution : [ 'genre' ] ,
336327 } ,
337328 method
338329 )
339330 . then ( ( response ) => {
340- expect (
341- response . facetsDistribution ?. genre ?. adventure === 0
342- ) . toBeTruthy ( )
343- expect ( response . facetsDistribution ?. genre ?. fantasy === 0 ) . toBeTruthy ( )
344- expect ( response . facetsDistribution ?. genre ?. romance === 2 ) . toBeTruthy ( )
345- expect (
346- response . facetsDistribution ?. genre [ 'sci fi' ] === 0
347- ) . toBeTruthy ( )
331+ expect ( response . facetsDistribution ?. genre ?. adventure ) . toBeUndefined ( )
332+ expect ( response . facetsDistribution ?. genre ?. fantasy ) . toBeUndefined ( )
333+ expect ( response . facetsDistribution ?. genre ?. romance ) . toBe ( 2 )
334+ expect ( response . facetsDistribution ?. genre [ 'sci fi' ] ) . toBeUndefined ( )
348335 expect ( response . exhaustiveFacetsCount === false ) . toBeTruthy ( )
349336 expect ( response . hits . length === 2 ) . toBeTruthy ( )
350337 } )
351338 } )
352339
353- test ( `${ permission } key: Search with filter with spaces` , async ( ) => {
340+ test ( `${ permission } key: ${ method } Search with filter with spaces` , async ( ) => {
354341 await client
355342 . index < Movie > ( index . uid )
356343 . search (
357344 'h' ,
358345 {
359- filter : [ 'genresci fi' ] ,
346+ filter : [ 'genre="sci fi" ' ] ,
360347 } ,
361348 method
362349 )
@@ -366,7 +353,7 @@ describe.each([
366353 } )
367354 } )
368355
369- test ( `${ permission } key: Search with multiple filter` , async ( ) => {
356+ test ( `${ permission } key: ${ method } Search with multiple filter` , async ( ) => {
370357 await client
371358 . index < Movie > ( index . uid )
372359 . search (
@@ -379,12 +366,12 @@ describe.each([
379366 )
380367 . then ( ( response ) => {
381368 expect ( response . facetsDistribution ?. genre ?. romance === 2 ) . toBeTruthy ( )
382- expect ( response . exhaustiveFacetsCount === true ) . toBeTruthy ( )
369+ expect ( response . exhaustiveFacetsCount === false ) . toBeTruthy ( )
383370 expect ( response . hits . length === 2 ) . toBeTruthy ( )
384371 } )
385372 } )
386373
387- test . only ( `${ permission } key: ${ method } search with multiple filter and placeholder search using undefined` , async ( ) => {
374+ test ( `${ permission } key: ${ method } search with multiple filter and placeholder search using undefined` , async ( ) => {
388375 await client
389376 . index < Movie > ( index . uid )
390377 . search (
0 commit comments