Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should remove any internal reference to the child context itself so that memory can be freed correctly', () => {
class Foo {}
const rootContext = iniettore.create(() => void 0)
let childContext = rootContext.createChild(map => {
map('foo')
.to(Foo)
.as(LAZY, SINGLETON, CONSTRUCTOR)
})
const detector = new LeakDetector(childContext)
childContext.get('foo')
childContext.dispose()
childContext = null
expect(detector.isLeaking()).toBe(false)
})
})
bar: singleton(() => {
const instance = new Bar()
detector = new LeakDetector(instance)
return instance
})
}))
.to(() => {
const instance = new Foo()
detector = new LeakDetector(instance)
return instance
})
.as(TRANSIENT, SINGLETON, PROVIDER)