@@ -147,6 +147,7 @@ describe.each([
147147    expect ( response ) . toHaveProperty ( 'offset' ,  0 ) 
148148    expect ( response ) . toHaveProperty ( 'processingTimeMs' ,  expect . any ( Number ) ) 
149149    expect ( response ) . toHaveProperty ( 'query' ,  'prince' ) 
150+     expect ( response . facetStats ) . toBeUndefined ( ) 
150151    expect ( response . hits . length ) . toEqual ( 2 ) 
151152    // @ts -expect-error Not present in the SearchResponse type because neither `page` or `hitsPerPage` is provided in the search params. 
152153    expect ( response . hitsPerPage ) . toBeUndefined ( ) 
@@ -506,12 +507,17 @@ describe.each([
506507    const  client  =  await  getClient ( permission ) 
507508    const  response  =  await  client . index ( index . uid ) . search ( 'a' ,  { 
508509      filter : [ 'genre = romance' ] , 
509-       facets : [ 'genre' ] , 
510+       facets : [ 'genre' ,   'id' ] , 
510511    } ) 
511512
512513    expect ( response ) . toHaveProperty ( 'facetDistribution' ,  { 
513514      genre : {  romance : 2  } , 
515+       id : {  '123' : 1 ,  '2' : 1  } , 
514516    } ) 
517+ 
518+     expect ( response ) . toHaveProperty ( 'facetStats' ,  {  id : {  min : 2 ,  max : 123  }  } ) 
519+     expect ( response . facetStats ?. [ 'id' ] ?. min ) . toBe ( 2 ) 
520+     expect ( response . facetStats ?. [ 'id' ] ?. max ) . toBe ( 123 ) 
515521    expect ( response ) . toHaveProperty ( 'hits' ,  expect . any ( Array ) ) 
516522    expect ( response . hits . length ) . toEqual ( 2 ) 
517523  } ) 
0 commit comments