From 044230209c3c0d817da9628802b8ef6d0b6aab86 Mon Sep 17 00:00:00 2001 From: Hugo Dominguez Date: Fri, 25 Aug 2023 13:20:37 -0600 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20add=20first=20page=20condition=20wh?= =?UTF-8?q?en=20search=20submit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search-form/search-form.component.spec.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app/shared/search-form/search-form.component.spec.ts b/src/app/shared/search-form/search-form.component.spec.ts index 584b7c5584..1fe1ea8316 100644 --- a/src/app/shared/search-form/search-form.component.spec.ts +++ b/src/app/shared/search-form/search-form.component.spec.ts @@ -28,6 +28,7 @@ describe('SearchFormComponent', () => { const searchService = new SearchServiceStub(); const paginationService = new PaginationServiceStub(); const searchConfigService = { paginationID: 'test-id' }; + const firstPage = { 'spc.page': 1 }; const dspaceObjectService = { findById: () => createSuccessfulRemoteDataObject$(undefined), }; @@ -104,16 +105,16 @@ describe('SearchFormComponent', () => { const scope = 'MCU'; let searchQuery = {}; - it('should navigate to the search page even when no parameters are provided', () => { + it('should navigate to the search first page even when no parameters are provided', () => { comp.updateSearch(searchQuery); expect(router.navigate).toHaveBeenCalledWith(comp.getSearchLinkParts(), { - queryParams: searchQuery, + queryParams: { ...searchQuery, ...firstPage }, queryParamsHandling: 'merge' }); }); - it('should navigate to the search page with parameters only query if only query is provided', () => { + it('should navigate to the search first page with parameters only query if only query is provided', () => { searchQuery = { query: query }; @@ -121,12 +122,12 @@ describe('SearchFormComponent', () => { comp.updateSearch(searchQuery); expect(router.navigate).toHaveBeenCalledWith(comp.getSearchLinkParts(), { - queryParams: searchQuery, + queryParams: { ...searchQuery, ...firstPage }, queryParamsHandling: 'merge' }); }); - it('should navigate to the search page with parameters only query if only scope is provided', () => { + it('should navigate to the search first page with parameters only query if only scope is provided', () => { searchQuery = { scope: scope }; @@ -134,7 +135,7 @@ describe('SearchFormComponent', () => { comp.updateSearch(searchQuery); expect(router.navigate).toHaveBeenCalledWith(comp.getSearchLinkParts(), { - queryParams: searchQuery, + queryParams: {...searchQuery, ...firstPage}, queryParamsHandling: 'merge' }); });