diff --git a/src/ngx-jsonapi.spec.ts b/src/ngx-jsonapi.spec.ts index de1bd2f0..2aa45406 100644 --- a/src/ngx-jsonapi.spec.ts +++ b/src/ngx-jsonapi.spec.ts @@ -1,5 +1,5 @@ import { JsonapiCore, NgxJsonapiModule } from '.'; - +import { JsonapiConfig } from './jsonapi-config'; /* This file is to import the main module. By importing it into this spec file, all the attached components get traversed and recognized @@ -13,7 +13,7 @@ describe('ngx-jsonapi Module', () => { it('should throw error when imported more than once', () => { expect( - (): NgxJsonapiModule => new NgxJsonapiModule(NgxJsonapiModule, new JsonapiCore(undefined, undefined, undefined)) + (): NgxJsonapiModule => new NgxJsonapiModule(NgxJsonapiModule, new JsonapiCore(new JsonapiConfig(), undefined, undefined)) ).toThrow(new Error('NgxJsonapiModule is already loaded. Import it in the AppModule only')); }); }); diff --git a/src/parent-resource-service.spec.ts b/src/parent-resource-service.spec.ts index fae5fe62..1460e58e 100644 --- a/src/parent-resource-service.spec.ts +++ b/src/parent-resource-service.spec.ts @@ -71,11 +71,32 @@ describe('parent-resource-service test', () => { .toEqual({ ...{}, ...Base.Params, ...exec_params_with_object.params }); }); it('proccess_exec_params() should fail if provided with a non IExecParams object', () => { - // TODO: cahnge test or fix method to return false or an error in such case let exec_params = { id: 'test_exec_params', params: 'test_exec_params' }; - expect(parentResourceServiceTest.testProccessExecParams(exec_params)).toBeFalsy(); + // expect error, typescript won't allow this + expect(parentResourceServiceTest.testProccessExecParams(exec_params).params).toEqual( + { + 0: 't', + 1: 'e', + 2: 's', + 3: 't', + 4: '_', + 5: 'e', + 6: 'x', + 7: 'e', + 8: 'c', + 9: '_', + 10: 'p', + 11: 'a', + 12: 'r', + 13: 'a', + 14: 'm', + 15: 's', + id: '', + include: [ ] + } + ); }); });