mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
fix BitstreamFormatsComponent tests
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { BitstreamFormatsComponent } from './bitstream-formats.component';
|
import { BitstreamFormatsComponent } from './bitstream-formats.component';
|
||||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of, of as observableOf } from 'rxjs';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
@@ -18,14 +18,18 @@ import { BitstreamFormatSupportLevel } from '../../../core/shared/bitstream-form
|
|||||||
import { cold, getTestScheduler, hot } from 'jasmine-marbles';
|
import { cold, getTestScheduler, hot } from 'jasmine-marbles';
|
||||||
import { TestScheduler } from 'rxjs/testing';
|
import { TestScheduler } from 'rxjs/testing';
|
||||||
import {
|
import {
|
||||||
|
createFailedRemoteDataObject$,
|
||||||
createNoContentRemoteDataObject$,
|
createNoContentRemoteDataObject$,
|
||||||
createSuccessfulRemoteDataObject,
|
createSuccessfulRemoteDataObject,
|
||||||
createSuccessfulRemoteDataObject$,
|
createSuccessfulRemoteDataObject$
|
||||||
createFailedRemoteDataObject$
|
|
||||||
} from '../../../shared/remote-data.utils';
|
} from '../../../shared/remote-data.utils';
|
||||||
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||||
|
import { GroupDataService } from '../../../core/eperson/group-data.service';
|
||||||
|
import { ConfigurationDataService } from '../../../core/data/configuration-data.service';
|
||||||
|
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import { provideMockStore } from '@ngrx/store/testing';
|
||||||
|
|
||||||
describe('BitstreamFormatsComponent', () => {
|
describe('BitstreamFormatsComponent', () => {
|
||||||
let comp: BitstreamFormatsComponent;
|
let comp: BitstreamFormatsComponent;
|
||||||
@@ -99,16 +103,31 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
clearBitStreamFormatRequests: observableOf('cleared')
|
clearBitStreamFormatRequests: observableOf('cleared')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const groupDataService = jasmine.createSpyObj('groupsDataService', {
|
||||||
|
findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
|
||||||
|
getGroupRegistryRouterLink: '',
|
||||||
|
getUUIDFromString: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const configurationDataService = jasmine.createSpyObj('ConfigurationDataService', {
|
||||||
|
findByPropertyName: of({payload: {value: 'test'}}),
|
||||||
|
});
|
||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
||||||
providers: [
|
providers: [
|
||||||
|
provideMockStore(),
|
||||||
{provide: BitstreamFormatDataService, useValue: bitstreamFormatService},
|
{provide: BitstreamFormatDataService, useValue: bitstreamFormatService},
|
||||||
{provide: HostWindowService, useValue: new HostWindowServiceStub(0)},
|
{provide: HostWindowService, useValue: new HostWindowServiceStub(0)},
|
||||||
{provide: NotificationsService, useValue: notificationsServiceStub},
|
{provide: NotificationsService, useValue: notificationsServiceStub},
|
||||||
{ provide: PaginationService, useValue: paginationService }
|
{provide: PaginationService, useValue: paginationService},
|
||||||
]
|
{provide: GroupDataService, useValue: groupDataService},
|
||||||
|
{provide: ConfigurationDataService, useValue: configurationDataService}
|
||||||
|
],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -226,17 +245,39 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
clearBitStreamFormatRequests: observableOf('cleared')
|
clearBitStreamFormatRequests: observableOf('cleared')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const groupDataService = jasmine.createSpyObj('groupsDataService', {
|
||||||
|
findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
|
||||||
|
getGroupRegistryRouterLink: '',
|
||||||
|
getUUIDFromString: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const configurationDataService = jasmine.createSpyObj('ConfigurationDataService', {
|
||||||
|
findByPropertyName: of({payload: {value: 'test'}}),
|
||||||
|
});
|
||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule,
|
||||||
|
BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
||||||
providers: [
|
providers: [
|
||||||
|
provideMockStore(),
|
||||||
{provide: BitstreamFormatDataService, useValue: bitstreamFormatService},
|
{provide: BitstreamFormatDataService, useValue: bitstreamFormatService},
|
||||||
{provide: HostWindowService, useValue: new HostWindowServiceStub(0)},
|
{provide: HostWindowService, useValue: new HostWindowServiceStub(0)},
|
||||||
{provide: NotificationsService, useValue: notificationsServiceStub},
|
{provide: NotificationsService, useValue: notificationsServiceStub},
|
||||||
{ provide: PaginationService, useValue: paginationService }
|
{provide: PaginationService, useValue: paginationService},
|
||||||
]
|
{provide: GroupDataService, useValue: groupDataService},
|
||||||
}).compileComponents();
|
{provide: ConfigurationDataService, useValue: configurationDataService}
|
||||||
|
],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
})
|
||||||
|
.overrideComponent(BitstreamFormatsComponent, {
|
||||||
|
remove: {imports: [PaginationComponent]},
|
||||||
|
add: {imports: [TestPaginationComponent]}
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -274,17 +315,37 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
clearBitStreamFormatRequests: observableOf('cleared')
|
clearBitStreamFormatRequests: observableOf('cleared')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const groupDataService = jasmine.createSpyObj('groupsDataService', {
|
||||||
|
findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
|
||||||
|
getGroupRegistryRouterLink: '',
|
||||||
|
getUUIDFromString: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
const configurationDataService = jasmine.createSpyObj('ConfigurationDataService', {
|
||||||
|
findByPropertyName: of({payload: {value: 'test'}}),
|
||||||
|
});
|
||||||
|
|
||||||
paginationService = new PaginationServiceStub();
|
paginationService = new PaginationServiceStub();
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule, BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
|
||||||
providers: [
|
providers: [
|
||||||
|
provideMockStore(),
|
||||||
{provide: BitstreamFormatDataService, useValue: bitstreamFormatService},
|
{provide: BitstreamFormatDataService, useValue: bitstreamFormatService},
|
||||||
{provide: HostWindowService, useValue: new HostWindowServiceStub(0)},
|
{provide: HostWindowService, useValue: new HostWindowServiceStub(0)},
|
||||||
{provide: NotificationsService, useValue: notificationsServiceStub},
|
{provide: NotificationsService, useValue: notificationsServiceStub},
|
||||||
{ provide: PaginationService, useValue: paginationService }
|
{provide: PaginationService, useValue: paginationService},
|
||||||
]
|
{provide: PaginationService, useValue: paginationService},
|
||||||
}).compileComponents();
|
{provide: GroupDataService, useValue: groupDataService},
|
||||||
|
{provide: ConfigurationDataService, useValue: configurationDataService}
|
||||||
|
],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
})
|
||||||
|
.overrideComponent(BitstreamFormatsComponent, {
|
||||||
|
remove: {imports: [PaginationComponent]},
|
||||||
|
add: {imports: [TestPaginationComponent]}
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -304,3 +365,12 @@ describe('BitstreamFormatsComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
exportAs: 'paginationComponent',
|
||||||
|
selector: 'ds-pagination',
|
||||||
|
template: ``,
|
||||||
|
standalone: true,
|
||||||
|
})
|
||||||
|
export class TestPaginationComponent {
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user