Commits

Enea Jahollari authored 2ac4b43e58b
fix ClaimedApprovedSearchResultListElementComponent tests
No tags

src/app/shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-approved-search-result/claimed-approved-search-result-list-element.component.spec.ts

Modified
13 13 import { TruncatableService } from '../../../../truncatable/truncatable.service';
14 14 import { LinkService } from '../../../../../core/cache/builders/link.service';
15 15 import { ClaimedApprovedTaskSearchResult } from '../../../../object-collection/shared/claimed-approved-task-search-result.model';
16 16 import { ClaimedApprovedSearchResultListElementComponent } from './claimed-approved-search-result-list-element.component';
17 17 import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
18 18 import { DSONameServiceMock } from '../../../../mocks/dso-name.service.mock';
19 19 import { APP_CONFIG } from '../../../../../../config/app-config.interface';
20 20 import { environment } from '../../../../../../environments/environment';
21 21 import { Context } from '../../../../../core/shared/context.model';
22 22 import { TranslateModule } from '@ngx-translate/core';
23 +import { mockTruncatableService } from '../../../../mocks/mock-trucatable.service';
24 +import { getMockThemeService } from '../../../../mocks/theme-service.mock';
25 +import { ThemeService } from '../../../../theme-support/theme.service';
23 26
24 27 let component: ClaimedApprovedSearchResultListElementComponent;
25 28 let fixture: ComponentFixture<ClaimedApprovedSearchResultListElementComponent>;
26 29
27 30 const mockResultObject: ClaimedApprovedTaskSearchResult = new ClaimedApprovedTaskSearchResult();
28 31 mockResultObject.hitHighlights = {};
29 32
30 33 const item = Object.assign(new Item(), {
31 34 bundles: observableOf({}),
32 35 metadata: {
64 67
65 68 describe('ClaimedApprovedSearchResultListElementComponent', () => {
66 69 beforeEach(waitForAsync(() => {
67 70 TestBed.configureTestingModule({
68 71 imports: [
69 72 TranslateModule.forRoot(),
70 73 NoopAnimationsModule,
71 74 ClaimedApprovedSearchResultListElementComponent, VarDirective
72 75 ],
73 76 providers: [
74 - { provide: TruncatableService, useValue: {} },
77 + { provide: TruncatableService, useValue: mockTruncatableService },
78 + { provide: ThemeService, useValue: getMockThemeService() },
75 79 { provide: LinkService, useValue: linkService },
76 80 { provide: DSONameService, useClass: DSONameServiceMock },
77 81 { provide: APP_CONFIG, useValue: environment }
78 82 ],
79 83 schemas: [NO_ERRORS_SCHEMA]
80 84 }).overrideComponent(ClaimedApprovedSearchResultListElementComponent, {
81 85 set: { changeDetection: ChangeDetectionStrategy.Default }
82 86 }).compileComponents();
83 87 }));
84 88

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut