diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.spec.ts b/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.spec.ts index 6e7f2f57f8..1d1e463a9e 100644 --- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.spec.ts +++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.spec.ts @@ -10,6 +10,17 @@ import { ItemSearchResult } from '../../../../../object-collection/shared/item-s import { DSONameService } from '../../../../../../core/breadcrumbs/dso-name.service'; import { DSONameServiceMock, UNDEFINED_NAME } from '../../../../../mocks/dso-name.service.mock'; import { APP_CONFIG } from '../../../../../../../config/app-config.interface'; +import { getMockThemeService } from '../../../../../mocks/theme-service.mock'; +import { ThemeService } from '../../../../../theme-support/theme.service'; +import { TranslateModule } from '@ngx-translate/core'; +import { ThemedBadgesComponent } from '../../../../../object-collection/shared/badges/themed-badges.component'; +import { ActivatedRoute } from '@angular/router'; +import { ActivatedRouteStub } from '../../../../../testing/active-router.stub'; +import { AuthService } from '../../../../../../core/auth/auth.service'; +import { AuthServiceStub } from '../../../../../testing/auth-service.stub'; +import { AuthorizationDataService } from '../../../../../../core/data/feature-authorization/authorization-data.service'; +import { TruncatableComponent } from '../../../../../truncatable/truncatable.component'; +import { TruncatablePartComponent } from '../../../../../truncatable/truncatable-part/truncatable-part.component'; let publicationListElementComponent: ItemSearchResultListElementComponent; let fixture: ComponentFixture; @@ -187,15 +198,29 @@ const enviromentNoThumbs = { describe('ItemSearchResultListElementComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [ItemSearchResultListElementComponent, TruncatePipe], + imports: [ + TranslateModule.forRoot(), + ItemSearchResultListElementComponent, + TruncatePipe + ], providers: [ { provide: TruncatableService, useValue: {} }, { provide: DSONameService, useClass: DSONameServiceMock }, - { provide: APP_CONFIG, useValue: environmentUseThumbs } + { provide: APP_CONFIG, useValue: environmentUseThumbs }, + { provide: ThemeService, useValue: getMockThemeService() }, + { provide: AuthService, useValue: new AuthServiceStub() }, + { provide: ActivatedRoute, useValue: new ActivatedRouteStub() }, + { + provide: AuthorizationDataService, + useValue: jasmine.createSpyObj('AuthorizationDataService', [ + 'invalidateAuthorizationsRequestCache' + ]) + } ], schemas: [NO_ERRORS_SCHEMA] }).overrideComponent(ItemSearchResultListElementComponent, { - set: { changeDetection: ChangeDetectionStrategy.Default } + add: {changeDetection: ChangeDetectionStrategy.Default}, + remove: { imports: [ThemedBadgesComponent, TruncatableComponent, TruncatablePartComponent]} }).compileComponents(); })); diff --git a/src/app/shared/truncatable/truncatable.service.ts b/src/app/shared/truncatable/truncatable.service.ts index 60e8a7df41..cdb011d6b3 100644 --- a/src/app/shared/truncatable/truncatable.service.ts +++ b/src/app/shared/truncatable/truncatable.service.ts @@ -15,7 +15,7 @@ const truncatableStateSelector = (state: TruncatablesState) => state.truncatable /** * Service responsible for truncating/clamping text and performing actions on truncatable elements */ -@Injectable() +@Injectable({ providedIn: 'root' }) export class TruncatableService { constructor(private store: Store) {