reverse initialization order, prepare for publishing
This commit is contained in:
@@ -9,7 +9,7 @@ export abstract class IComponentB{
|
||||
}
|
||||
|
||||
@Singleton({
|
||||
interface: IComponentB
|
||||
interface: IComponentB,
|
||||
})
|
||||
export class ComponentB implements IComponentB, Initializable{
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { Inject, Singleton } from "../../src/Decorator"
|
||||
import { Initializable } from "../../src/Interfaces"
|
||||
import { COMPONENT_B_VALUE, COMPONENT_C_VALUE } from "../CONSTANTS"
|
||||
import { COMPONENT_C_VALUE } from "../CONSTANTS"
|
||||
import { ComponentA } from "./ComponentA"
|
||||
|
||||
export class benis{
|
||||
|
||||
}
|
||||
|
||||
export abstract class IComponentC{
|
||||
getFromA: () => string
|
||||
getFromThis: () => string
|
||||
@@ -11,7 +14,7 @@ export abstract class IComponentC{
|
||||
@Singleton({
|
||||
interface: IComponentC,
|
||||
})
|
||||
export class ComponentC implements IComponentC{
|
||||
export class ComponentC{
|
||||
|
||||
@Inject(ComponentA)
|
||||
private componentA: ComponentA
|
||||
|
||||
@@ -9,7 +9,7 @@ var chaiAsPromised = require("chai-as-promised");
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
|
||||
describe('dependjs', () => {
|
||||
describe('BasicTest', () => {
|
||||
it('is able to resolve linear dependencies', () => {
|
||||
|
||||
const testComp = Injector.resolve(TestComponent)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Inject, Singleton } from "../../src/Decorator";
|
||||
import { Initializable } from "../../src/Interfaces";
|
||||
import {ComponentA} from "./ComponentA"
|
||||
import {IComponentB} from "./ComponentB"
|
||||
import { ComponentC } from "./ComponentC";
|
||||
|
||||
@@ -8,12 +8,12 @@ var chaiAsPromised = require("chai-as-promised");
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
|
||||
describe('dependjs', () => {
|
||||
describe('InitializationTest', () => {
|
||||
it('initialized in the requested order', () => {
|
||||
|
||||
const testComp = Injector.resolve(TestComponent)
|
||||
const data = testComp.getData()
|
||||
|
||||
expect(data).to.eql([COMPONENT_C_VALUE, COMPONENT_B_VALUE, COMPONENT_A_VALUE])
|
||||
expect(data).to.eql([COMPONENT_A_VALUE, COMPONENT_B_VALUE, COMPONENT_C_VALUE])
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user