From 6e088a02ca8c24af72b5a1cd6e162ba987adf0e7 Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Fri, 28 Dec 2018 18:53:26 +0100 Subject: [PATCH] Added tests --- .../json-patch-operations.effects.spec.ts | 4 -- ...sion-json-patch-operations.service.spec.ts | 40 +++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 src/app/core/submission/submission-json-patch-operations.service.spec.ts diff --git a/src/app/core/json-patch/json-patch-operations.effects.spec.ts b/src/app/core/json-patch/json-patch-operations.effects.spec.ts index a21f8ec46a..c0fa12cbf3 100644 --- a/src/app/core/json-patch/json-patch-operations.effects.spec.ts +++ b/src/app/core/json-patch/json-patch-operations.effects.spec.ts @@ -22,11 +22,7 @@ describe('JsonPatchOperationsEffects test suite', () => { const testJsonPatchResourceType = 'testResourceType'; const testJsonPatchResourceId = 'testResourceId'; - function init() { - } - beforeEach(() => { - init(); TestBed.configureTestingModule({ providers: [ JsonPatchOperationsEffects, diff --git a/src/app/core/submission/submission-json-patch-operations.service.spec.ts b/src/app/core/submission/submission-json-patch-operations.service.spec.ts new file mode 100644 index 0000000000..d0682720d1 --- /dev/null +++ b/src/app/core/submission/submission-json-patch-operations.service.spec.ts @@ -0,0 +1,40 @@ +import { Store } from '@ngrx/store'; + +import { getTestScheduler } from 'jasmine-marbles'; +import { TestScheduler } from 'rxjs/testing'; + +import { ResponseCacheService } from '../cache/response-cache.service'; +import { CoreState } from '../core.reducers'; +import { HALEndpointService } from '../shared/hal-endpoint.service'; +import { SubmissionJsonPatchOperationsService } from './submission-json-patch-operations.service'; +import { RequestService } from '../data/request.service'; +import { SubmissionPatchRequest } from '../data/request.models'; + +describe('SubmissionJsonPatchOperationsService', () => { + let scheduler: TestScheduler; + let service: SubmissionJsonPatchOperationsService; + const requestService = {} as RequestService; + const responseCache = {} as ResponseCacheService; + const store = {} as Store; + const halEndpointService = {} as HALEndpointService; + + function initTestService() { + return new SubmissionJsonPatchOperationsService( + responseCache, + requestService, + store, + halEndpointService + ); + } + + beforeEach(() => { + scheduler = getTestScheduler(); + service = initTestService(); + }); + + it('should instantiate SubmissionJsonPatchOperationsService properly', () => { + expect(service).toBeDefined(); + expect((service as any).patchRequestConstructor).toEqual(SubmissionPatchRequest); + }); + +});