diff --git a/src/app/browse-by/browse-by-date/browse-by-date.component.spec.ts b/src/app/browse-by/browse-by-date/browse-by-date.component.spec.ts index c813de329b0..66172fabd17 100644 --- a/src/app/browse-by/browse-by-date/browse-by-date.component.spec.ts +++ b/src/app/browse-by/browse-by-date/browse-by-date.component.spec.ts @@ -96,8 +96,8 @@ describe('BrowseByDateComponent', () => { findById: () => createSuccessfulRemoteDataObject$(mockCommunity), }; - const activatedRouteStub = Object.assign(new ActivatedRouteStub(), { - params: of({}), + const activatedRouteStub = Object.assign(new ActivatedRouteStub({ id: 'dateissued' }), { + params: of({ id: 'dateissued' }), queryParams: of({}), data: of({ metadata: 'dateissued', metadataField: 'dc.date.issued' }), }); @@ -152,9 +152,8 @@ describe('BrowseByDateComponent', () => { fixture = TestBed.createComponent(BrowseByDateComponent); const browseService = fixture.debugElement.injector.get(BrowseService); spyOn(browseService, 'getFirstItemFor') - // ok to expect the default browse as first param since we just need the mock items obtained via sort direction. - .withArgs('author', undefined, SortDirection.ASC).and.returnValue(createSuccessfulRemoteDataObject$(firstItem)) - .withArgs('author', undefined, SortDirection.DESC).and.returnValue(createSuccessfulRemoteDataObject$(lastItem)); + .withArgs('dateissued', undefined, SortDirection.ASC).and.returnValue(createSuccessfulRemoteDataObject$(firstItem)) + .withArgs('dateissued', undefined, SortDirection.DESC).and.returnValue(createSuccessfulRemoteDataObject$(lastItem)); comp = fixture.componentInstance; route = (comp as any).route; fixture.detectChanges(); diff --git a/src/app/browse-by/browse-by-date/browse-by-date.component.ts b/src/app/browse-by/browse-by-date/browse-by-date.component.ts index c65f16cfd5f..e9c33d8da63 100644 --- a/src/app/browse-by/browse-by-date/browse-by-date.component.ts +++ b/src/app/browse-by/browse-by-date/browse-by-date.component.ts @@ -110,7 +110,7 @@ export class BrowseByDateComponent extends BrowseByMetadataComponent implements })).subscribe(({ params, scope, currentPage, currentSort }) => { const metadataKeys = params.browseDefinition ? params.browseDefinition.metadataKeys : this.defaultMetadataKeys; this.startsWith = +params.startsWith || params.startsWith; - this.browseId = params.id || this.defaultBrowseId; + this.browseId = params.id; const searchOptions = browseParamsToOptions(params, scope, currentPage, currentSort, this.browseId, this.fetchThumbnails); this.updatePageWithItems(searchOptions, this.value, undefined); this.updateStartsWithOptions(this.browseId, metadataKeys, params.scope); diff --git a/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.spec.ts b/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.spec.ts index 00e95a82d33..631d1c70132 100644 --- a/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.spec.ts +++ b/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.spec.ts @@ -124,8 +124,8 @@ describe('BrowseByMetadataComponent', () => { findById: () => createSuccessfulRemoteDataObject$(mockCommunity), }; - const activatedRouteStub = Object.assign(new ActivatedRouteStub(), { - params: of({}), + const activatedRouteStub = Object.assign(new ActivatedRouteStub({ id: 'author' }), { + params: of({ id: 'author' }), }); paginationService = new PaginationServiceStub(); diff --git a/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.ts b/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.ts index f88f8a374cb..a5fcebb4891 100644 --- a/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.ts +++ b/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.ts @@ -137,15 +137,10 @@ export class BrowseByMetadataComponent implements OnInit, OnChanges, OnDestroy { */ subs: Subscription[] = []; - /** - * The default browse id to resort to when none is provided - */ - defaultBrowseId = 'author'; - /** * The current browse id */ - browseId = this.defaultBrowseId; + browseId: string; /** * The type of StartsWith options to render diff --git a/src/app/browse-by/browse-by-title/browse-by-title.component.spec.ts b/src/app/browse-by/browse-by-title/browse-by-title.component.spec.ts index e5580e9799f..74f3ff4b94f 100644 --- a/src/app/browse-by/browse-by-title/browse-by-title.component.spec.ts +++ b/src/app/browse-by/browse-by-title/browse-by-title.component.spec.ts @@ -84,8 +84,8 @@ describe('BrowseByTitleComponent', () => { findById: () => createSuccessfulRemoteDataObject$(mockCommunity), }; - const activatedRouteStub = Object.assign(new ActivatedRouteStub(), { - params: of({}), + const activatedRouteStub = Object.assign(new ActivatedRouteStub({ id: 'title' }), { + params: of({ id: 'title' }), queryParams: of({}), data: of({ metadata: 'title' }), });