@@ -22,7 +22,9 @@ import {
2222 TranslateModule ,
2323} from '@ngx-translate/core' ;
2424
25+ import { PaginationService } from '../core/pagination/pagination.service' ;
2526import { SearchService } from '../shared/search/search.service' ;
27+ import { SearchConfigurationService } from '../shared/search/search-configuration.service' ;
2628import { SearchNavbarComponent } from './search-navbar.component' ;
2729
2830describe ( 'SearchNavbarComponent' , ( ) => {
@@ -54,6 +56,14 @@ describe('SearchNavbarComponent', () => {
5456 ] ,
5557 providers : [
5658 { provide : SearchService , useValue : mockSearchService } ,
59+ { provide : PaginationService , useValue : { getPageParam : ( id : string ) => `${ id } .page` } } ,
60+ {
61+ provide : SearchConfigurationService ,
62+ useValue : {
63+ searchInstanceId : 'spc' ,
64+ getCurrentSearchInstanceParam : ( param : string ) => `spc.${ param } ` ,
65+ } ,
66+ } ,
5767 ] ,
5868 } )
5969 . compileComponents ( ) ;
@@ -100,7 +110,7 @@ describe('SearchNavbarComponent', () => {
100110 fixture . detectChanges ( ) ;
101111 } ) ) ;
102112 it ( 'to search page with empty query' , ( ) => {
103- const extras : NavigationExtras = { queryParams : { query : '' } } ;
113+ const extras : NavigationExtras = { queryParams : { 'spc. query' : '' , 'spc.page' : 1 } } ;
104114 expect ( component . onSubmit ) . toHaveBeenCalledWith ( { query : '' } ) ;
105115 expect ( router . navigate ) . toHaveBeenCalledWith ( [ 'search' ] , extras ) ;
106116 } ) ;
@@ -125,7 +135,7 @@ describe('SearchNavbarComponent', () => {
125135 fixture . detectChanges ( ) ;
126136 } ) ) ;
127137 it ( 'to search page with query' , async ( ) => {
128- const extras : NavigationExtras = { queryParams : { query : 'test' } } ;
138+ const extras : NavigationExtras = { queryParams : { 'spc. query' : 'test' , 'spc.page' : 1 } } ;
129139 expect ( component . onSubmit ) . toHaveBeenCalledWith ( { query : 'test' } ) ;
130140
131141 expect ( router . navigate ) . toHaveBeenCalledWith ( [ 'search' ] , extras ) ;
0 commit comments