@@ -655,16 +655,36 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/infinite-hi
655655 } ) ;
656656
657657 describe ( 'getConfiguration' , ( ) => {
658- it ( 'adds a `page` to the `SearchParameters`' , ( ) => {
658+ it ( 'returns `SearchParameters`' , ( ) => {
659659 const renderFn = ( ) : void => { } ;
660660 const makeWidget = connectInfiniteHits ( renderFn ) ;
661661 const widget = makeWidget ( { } ) ;
662662
663- const nextConfiguration = widget . getConfiguration ! (
664- new SearchParameters ( )
663+ expect ( widget . getConfiguration ! ( new SearchParameters ( ) ) ) . toBeInstanceOf (
664+ SearchParameters
665665 ) ;
666+ } ) ;
667+
668+ it ( 'adds a `page` to the `SearchParameters`' , ( ) => {
669+ const renderFn = ( ) : void => { } ;
670+ const makeWidget = connectInfiniteHits ( renderFn ) ;
671+ const widget = makeWidget ( { } ) ;
672+
673+ expect ( widget . getConfiguration ! ( new SearchParameters ( ) ) . page ) . toEqual ( 0 ) ;
674+ } ) ;
675+
676+ it ( 'supports previous `page` from the `SearchParameters`' , ( ) => {
677+ const renderFn = ( ) : void => { } ;
678+ const makeWidget = connectInfiniteHits ( renderFn ) ;
679+ const widget = makeWidget ( { } ) ;
680+
681+ expect (
682+ widget . getConfiguration ! ( new SearchParameters ( { page : 0 } ) ) . page
683+ ) . toEqual ( 0 ) ;
666684
667- expect ( nextConfiguration . page ) . toBe ( 0 ) ;
685+ expect (
686+ widget . getConfiguration ! ( new SearchParameters ( { page : 6 } ) ) . page
687+ ) . toEqual ( 6 ) ;
668688 } ) ;
669689
670690 it ( 'adds the TAG_PLACEHOLDER to the `SearchParameters`' , ( ) => {
0 commit comments