reverse initialization order, prepare for publishing

This commit is contained in:
nitowa
2022-10-16 02:45:49 +02:00
parent 963a3a9652
commit a373b178c6
10 changed files with 20 additions and 17 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ export abstract class IComponentB{
}
@Singleton({
interface: IComponentB
interface: IComponentB,
})
export class ComponentB implements IComponentB, Initializable{
+6 -3
View File
@@ -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
+1 -1
View File
@@ -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
View File
@@ -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";
+2 -2
View File
@@ -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])
})
})