Skip to content

Commit

Permalink
Fixed unit tests - added configurationDataService
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmajchrak committed Dec 14, 2023
1 parent 8531caa commit 6fe69e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { CookieServiceMock } from '../../shared/mocks/cookie.service.mock';
import { HttpXsrfTokenExtractorMock } from '../../shared/mocks/http-xsrf-token-extractor.mock';
import { getMockEntityTypeService } from './my-dspace-new-submission-dropdown/my-dspace-new-submission-dropdown.component.spec';
import { EntityTypeDataService } from '../../core/data/entity-type-data.service';
import { of } from 'rxjs';
import { ConfigurationDataService } from '../../core/data/configuration-data.service';

describe('MyDSpaceNewSubmissionComponent test', () => {

Expand All @@ -35,6 +37,10 @@ describe('MyDSpaceNewSubmissionComponent test', () => {
uploadAll: jasmine.createSpy('uploadAll').and.stub()
});

const configurationServiceSpy = jasmine.createSpyObj('configurationService', {
findByPropertyName: of({}),
});

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
Expand Down Expand Up @@ -64,6 +70,7 @@ describe('MyDSpaceNewSubmissionComponent test', () => {
{ provide: CookieService, useValue: new CookieServiceMock() },
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) },
{ provide: EntityTypeDataService, useValue: getMockEntityTypeService() },
{ provide: ConfigurationDataService, useValue: configurationServiceSpy },
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
Expand Down
7 changes: 7 additions & 0 deletions src/app/shared/upload/uploader/uploader.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,19 @@ import { HttpXsrfTokenExtractor } from '@angular/common/http';
import { CookieService } from '../../../core/services/cookie.service';
import { CookieServiceMock } from '../../mocks/cookie.service.mock';
import { HttpXsrfTokenExtractorMock } from '../../mocks/http-xsrf-token-extractor.mock';
import { of } from 'rxjs';
import { ConfigurationDataService } from '../../../core/data/configuration-data.service';

describe('Chips component', () => {

let testComp: TestComponent;
let testFixture: ComponentFixture<TestComponent>;
let html;

const configurationServiceSpy = jasmine.createSpyObj('configurationService', {
findByPropertyName: of({}),
});

// waitForAsync beforeEach
beforeEach(waitForAsync(() => {

Expand All @@ -40,6 +46,7 @@ describe('Chips component', () => {
DragService,
{ provide: HttpXsrfTokenExtractor, useValue: new HttpXsrfTokenExtractorMock('mock-token') },
{ provide: CookieService, useValue: new CookieServiceMock() },
{ provide: ConfigurationDataService, useValue: configurationServiceSpy },
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
});
Expand Down

0 comments on commit 6fe69e1

Please sign in to comment.