Skip to content

Commit eda8065

Browse files
test(): fix unit tests (module replace)
1 parent fb72dcc commit eda8065

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

packages/core/test/injector/module.spec.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,21 +272,28 @@ describe('Module', () => {
272272

273273
describe('replace', () => {
274274
describe('when provider', () => {
275-
it('should call `addProvider`', () => {
276-
const addProviderSpy = sinon.spy(module, 'addProvider');
275+
it('should call `mergeWith`', () => {
276+
const wrapper = {
277+
mergeWith: sinon.spy(),
278+
};
277279
sinon.stub(module, 'hasProvider').callsFake(() => true);
280+
sinon.stub(module.providers, 'get').callsFake(() => wrapper as any);
278281

279282
module.replace(null, { isProvider: true });
280-
expect(addProviderSpy.called).to.be.true;
283+
expect(wrapper.mergeWith.called).to.be.true;
281284
});
282285
});
283286
describe('when guard', () => {
284-
it('should call `addInjectable`', () => {
285-
const addInjectableSpy = sinon.spy(module, 'addInjectable');
287+
it('should call `mergeWith`', () => {
288+
const wrapper = {
289+
mergeWith: sinon.spy(),
290+
isProvider: true,
291+
};
286292
sinon.stub(module, 'hasInjectable').callsFake(() => true);
293+
sinon.stub(module.injectables, 'get').callsFake(() => wrapper as any);
287294

288295
module.replace(null, {});
289-
expect(addInjectableSpy.called).to.be.true;
296+
expect(wrapper.mergeWith.called).to.be.true;
290297
});
291298
});
292299
});

0 commit comments

Comments
 (0)