tlojs
Version:
The Last One - The last npm package you'll need to install
22 lines (18 loc) • 437 B
text/typescript
import { Injector, Injectable } from "../injection"
describe('Depedency Injection', () => {
it('should inject', () => {
class A {
getNumber() { return 1 }
}
class B {
constructor(public a: A) {
}
}
const service = Injector.resolve<B>(B)
expect(service).toBeTruthy()
expect(service.a).toBeTruthy()
expect(service.a.getNumber()).toEqual(1)
})
})