Skip to content

Commit

Permalink
test(core): add test for when the value of value provider is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
micalevisk committed Feb 17, 2023
1 parent 5292ccf commit 1127e15
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/core/test/injector/module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,16 @@ describe('Module', () => {
expect((addCustomValue as sinon.SinonSpy).called).to.be.true;
});

it('should call "addCustomValue" when "useValue" property exists but its value is `undefiend`', () => {
const addCustomValue = sinon.spy();
module.addCustomValue = addCustomValue;

const provider = { provide: 'test', useValue: undefined };

module.addCustomProvider(provider as any, new Map());
expect((addCustomValue as sinon.SinonSpy).called).to.be.true;
});

it('should call "addCustomFactory" when "useFactory" property exists', () => {
const addCustomFactory = sinon.spy();
module.addCustomFactory = addCustomFactory;
Expand Down

0 comments on commit 1127e15

Please sign in to comment.