fixed tests in relaitonship service

This commit is contained in:
lotte
2020-02-05 16:53:39 +01:00
parent 405143388c
commit 6cfcff5503
6 changed files with 104 additions and 49 deletions

View File

@@ -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();