diff --git a/project/tests/CustomEnvironment.ts b/project/tests/CustomEnvironment.ts index da6ac070..c7420158 100644 --- a/project/tests/CustomEnvironment.ts +++ b/project/tests/CustomEnvironment.ts @@ -5,6 +5,7 @@ import NodeEnvironment from "jest-environment-node"; import type { EnvironmentContext, JestEnvironmentConfig } from "@jest/environment"; import { Container } from "@spt-aki/di/Container"; +import { DatabaseImporter } from "@spt-aki/utils/DatabaseImporter"; export default class CustomEnvironment extends NodeEnvironment { @@ -17,7 +18,11 @@ export default class CustomEnvironment extends NodeEnvironment { await super.setup(); - Container.registerTypes(container); + await Container.registerTypes(container); + + const databaseImporter = container.resolve("DatabaseImporter"); + await databaseImporter.onLoad(); + this.global.container = container; } diff --git a/project/tests/helpers/ItemHelper.test.ts b/project/tests/helpers/ItemHelper.test.ts index 9acd9437..4a4e2edc 100644 --- a/project/tests/helpers/ItemHelper.test.ts +++ b/project/tests/helpers/ItemHelper.test.ts @@ -1,14 +1,17 @@ import "reflect-metadata"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; +import { DependencyContainer } from "tsyringe"; describe("ItemHelper", () => { + let container: DependencyContainer; let itemHelper: ItemHelper; beforeAll(() => { - itemHelper = globalThis.container.resolve("ItemHelper"); + container = globalThis.container; + itemHelper = container.resolve("ItemHelper"); }); afterEach(() =>