feat: fix CollectionDropdownComponent test

This commit is contained in:
Enea Jahollari
2023-09-26 09:45:03 +02:00
parent b0af3e7b8d
commit 65e786bd1f

View File

@@ -15,6 +15,8 @@ import { CollectionDataService } from '../../core/data/collection-data.service';
import { TranslateLoaderMock } from '../mocks/translate-loader.mock'; import { TranslateLoaderMock } from '../mocks/translate-loader.mock';
import { Community } from '../../core/shared/community.model'; import { Community } from '../../core/shared/community.model';
import { MockElementRef } from '../testing/element-ref.mock'; import { MockElementRef } from '../testing/element-ref.mock';
import { getMockThemeService } from '../mocks/theme-service.mock';
import { ThemeService } from '../theme-support/theme.service';
const community: Community = Object.assign(new Community(), { const community: Community = Object.assign(new Community(), {
id: 'ce64f48e-2c9b-411a-ac36-ee429c0e6a88', id: 'ce64f48e-2c9b-411a-ac36-ee429c0e6a88',
@@ -100,6 +102,8 @@ describe('CollectionDropdownComponent', () => {
let fixture: ComponentFixture<CollectionDropdownComponent>; let fixture: ComponentFixture<CollectionDropdownComponent>;
let scheduler: TestScheduler; let scheduler: TestScheduler;
let themeService = getMockThemeService();
const collectionDataServiceMock: any = jasmine.createSpyObj('CollectionDataService', { const collectionDataServiceMock: any = jasmine.createSpyObj('CollectionDataService', {
getAuthorizedCollection: jasmine.createSpy('getAuthorizedCollection'), getAuthorizedCollection: jasmine.createSpy('getAuthorizedCollection'),
getAuthorizedCollectionByEntityType: jasmine.createSpy('getAuthorizedCollectionByEntityType') getAuthorizedCollectionByEntityType: jasmine.createSpy('getAuthorizedCollectionByEntityType')
@@ -123,9 +127,10 @@ describe('CollectionDropdownComponent', () => {
CollectionDropdownComponent CollectionDropdownComponent
], ],
providers: [ providers: [
{ provide: CollectionDataService, useValue: collectionDataServiceMock }, {provide: CollectionDataService, useValue: collectionDataServiceMock},
{ provide: ElementRef, useClass: MockElementRef }, {provide: ElementRef, useClass: MockElementRef},
ChangeDetectorRef ChangeDetectorRef,
{provide: ThemeService, useValue: themeService},
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
}) })