@@ -147,6 +147,7 @@ describe.each([
147
147
expect ( response ) . toHaveProperty ( 'offset' , 0 )
148
148
expect ( response ) . toHaveProperty ( 'processingTimeMs' , expect . any ( Number ) )
149
149
expect ( response ) . toHaveProperty ( 'query' , 'prince' )
150
+ expect ( response . facetStats ) . toBeUndefined ( )
150
151
expect ( response . hits . length ) . toEqual ( 2 )
151
152
// @ts -expect-error Not present in the SearchResponse type because neither `page` or `hitsPerPage` is provided in the search params.
152
153
expect ( response . hitsPerPage ) . toBeUndefined ( )
@@ -506,12 +507,16 @@ describe.each([
506
507
const client = await getClient ( permission )
507
508
const response = await client . index ( index . uid ) . search ( 'a' , {
508
509
filter : [ 'genre = romance' ] ,
509
- facets : [ 'genre' ] ,
510
+ facets : [ 'genre' , 'id' ] ,
510
511
} )
511
512
512
513
expect ( response ) . toHaveProperty ( 'facetDistribution' , {
513
514
genre : { romance : 2 } ,
515
+ id : { '123' : 1 , '2' : 1 } ,
514
516
} )
517
+
518
+ expect ( response . facetStats ) . toEqual ( { id : { min : 2 , max : 123 } } )
519
+ expect ( response . facetStats ?. [ 'id' ] ?. max ) . toBe ( 123 )
515
520
expect ( response ) . toHaveProperty ( 'hits' , expect . any ( Array ) )
516
521
expect ( response . hits . length ) . toEqual ( 2 )
517
522
} )
0 commit comments