Skip to content

Commit

Permalink
test(): cover missing branches in module testing file
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed May 12, 2019
1 parent ae5e7ca commit 8bbf941
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion packages/core/test/injector/module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Module', () => {
const setSpy = sinon.spy(collection, 'set');
(module as any)._injectables = collection;

module.addInjectable(TestProvider);
module.addInjectable(TestProvider, TestModule);
expect(
setSpy.calledWith(
'TestProvider',
Expand Down Expand Up @@ -413,4 +413,25 @@ describe('Module', () => {
});
});
});

describe('getter "id"', () => {
it('should return module id', () => {
// tslint:disable-next-line:no-string-literal
expect(module.id).to.be.equal(module['_id']);
});
});

describe('getProviderByKey', () => {
describe('when does not exist', () => {
it('should return undefined', () => {
expect(module.getProviderByKey('test')).to.be.undefined;
});
});
describe('otherwise', () => {
it('should return instance wrapper', () => {
module.addProvider(TestProvider);
expect(module.getProviderByKey('TestProvider')).to.not.be.undefined;
});
});
});
});

0 comments on commit 8bbf941

Please sign in to comment.