Removed usage of global.container

Importing container from tsyringe directly seems to work fine.
This commit is contained in:
TheSparta 2023-10-28 20:40:11 +01:00
parent ba32350751
commit b31a48066b
2 changed files with 2 additions and 8 deletions

View File

@ -1,21 +1,18 @@
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe";
import { vi, beforeAll, afterEach, describe, expect, it } from "vitest"; import { vi, beforeAll, afterEach, describe, expect, it } from "vitest";
import { ItemHelper } from "@spt-aki/helpers/ItemHelper"; import { ItemHelper } from "@spt-aki/helpers/ItemHelper";
import { DependencyContainer } from "tsyringe";
import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem"; import { Item, Repairable } from "@spt-aki/models/eft/common/tables/IItem";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
describe("ItemHelper", () => describe("ItemHelper", () =>
{ {
let container: DependencyContainer;
let itemHelper: ItemHelper; let itemHelper: ItemHelper;
beforeAll(() => beforeAll(() =>
{ {
container = global.container;
itemHelper = container.resolve<ItemHelper>("ItemHelper"); itemHelper = container.resolve<ItemHelper>("ItemHelper");
}); });

View File

@ -1,18 +1,15 @@
import "reflect-metadata"; import "reflect-metadata";
import { container } from "tsyringe";
import { vi, beforeAll, afterEach, describe, expect, it } from "vitest"; import { vi, beforeAll, afterEach, describe, expect, it } from "vitest";
import { DependencyContainer } from "tsyringe";
import { PaymentService } from "@spt-aki/services/PaymentService"; import { PaymentService } from "@spt-aki/services/PaymentService";
describe("PaymentService", () => describe("PaymentService", () =>
{ {
let container: DependencyContainer;
let paymentService: PaymentService; let paymentService: PaymentService;
beforeAll(() => beforeAll(() =>
{ {
container = global.container;
paymentService = container.resolve<PaymentService>("PaymentService"); paymentService = container.resolve<PaymentService>("PaymentService");
}); });