Comparing version 1.8.0 to 1.8.1
@@ -342,2 +342,9 @@ const fs = require('fs'); | ||
// flush instances with old dependency | ||
Object.keys(factories).forEach((key) => { | ||
if (factories[key].dependencies.includes(name)) { | ||
delete factories[key].instance; | ||
} | ||
}); | ||
container.register(name, fn, opts); | ||
@@ -344,0 +351,0 @@ }, |
{ | ||
"name": "sdic", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"description": "Simple dependency injection container", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -66,2 +66,10 @@ const expect = require('chai').expect; | ||
it('should properly use overrriden module', () => { | ||
container.register('dependencyModule', () => 'original'); | ||
container.register('parentModule', (dependencyModule) => dependencyModule); | ||
expect(container.get('parentModule')).to.equal('original'); | ||
container.override('dependencyModule', () => 'overriden'); | ||
expect(container.get('parentModule')).to.equal('overriden'); | ||
}); | ||
describe('should be able to handle circular dependencies', () => { | ||
@@ -68,0 +76,0 @@ it('when resolving cache flag', () => { |
94979
911