mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
fixed tests in relaitonship service
This commit is contained in:
@@ -21,7 +21,6 @@ import {
|
||||
RollbacktPatchOperationsAction,
|
||||
StartTransactionPatchOperationsAction
|
||||
} from './json-patch-operations.actions';
|
||||
import { MockStore } from '../../shared/testing/mock-store';
|
||||
import { RequestEntry } from '../data/request.reducer';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
@@ -98,27 +97,22 @@ describe('JsonPatchOperationsService test suite', () => {
|
||||
|
||||
}
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
StoreModule.forRoot({}),
|
||||
],
|
||||
providers: [
|
||||
{ provide: Store, useClass: MockStore }
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
function getStore() {
|
||||
return jasmine.createSpyObj('store', {
|
||||
dispatch: {},
|
||||
select: observableOf(mockState['json/patch'][testJsonPatchResourceType]),
|
||||
pipe: observableOf(true)
|
||||
});
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
store = TestBed.get(Store);
|
||||
store = getStore();
|
||||
requestService = getMockRequestService(getRequestEntry$(true));
|
||||
rdbService = getMockRemoteDataBuildService();
|
||||
scheduler = getTestScheduler();
|
||||
halService = new HALEndpointServiceStub(resourceEndpointURL);
|
||||
service = initTestService();
|
||||
|
||||
spyOn(store, 'select').and.returnValue(observableOf(mockState['json/patch'][testJsonPatchResourceType]));
|
||||
spyOn(store, 'dispatch').and.callThrough();
|
||||
spyOn(Date.prototype, 'getTime').and.callFake(() => {
|
||||
return timestamp;
|
||||
});
|
||||
@@ -163,7 +157,7 @@ describe('JsonPatchOperationsService test suite', () => {
|
||||
|
||||
describe('when request is not successful', () => {
|
||||
beforeEach(() => {
|
||||
store = TestBed.get(Store);
|
||||
store = getStore();
|
||||
requestService = getMockRequestService(getRequestEntry$(false));
|
||||
rdbService = getMockRemoteDataBuildService();
|
||||
scheduler = getTestScheduler();
|
||||
@@ -226,7 +220,7 @@ describe('JsonPatchOperationsService test suite', () => {
|
||||
|
||||
describe('when request is not successful', () => {
|
||||
beforeEach(() => {
|
||||
store = TestBed.get(Store);
|
||||
store = getStore();
|
||||
requestService = getMockRequestService(getRequestEntry$(false));
|
||||
rdbService = getMockRemoteDataBuildService();
|
||||
scheduler = getTestScheduler();
|
||||
|
Reference in New Issue
Block a user