d13e86ba46
Rebranded src code and scripts to SPT Co-authored-by: clodan <clodan@clodan.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/345 Co-authored-by: Alex <clodan@noreply.dev.sp-tarkov.com> Co-committed-by: Alex <clodan@noreply.dev.sp-tarkov.com>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { container } from "tsyringe";
|
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
import { ProfileFixerService } from "@spt/services/ProfileFixerService";
|
|
|
|
describe("ProfileFixerService", () =>
|
|
{
|
|
let profileFixerService: any; // Using "any" to access private/protected methods without type errors.
|
|
|
|
beforeEach(() =>
|
|
{
|
|
profileFixerService = container.resolve<ProfileFixerService>("ProfileFixerService");
|
|
});
|
|
|
|
afterEach(() =>
|
|
{
|
|
vi.restoreAllMocks();
|
|
});
|
|
|
|
describe("FixPmcProfileIssues", () =>
|
|
{
|
|
it("should reset nextResupply to 0 when it is null", () =>
|
|
{
|
|
const pmcProfile = { TradersInfo: { traderId: { nextResupply: null } } };
|
|
|
|
profileFixerService.fixNullTraderNextResupply(pmcProfile);
|
|
|
|
expect(pmcProfile.TradersInfo.traderId.nextResupply).toBe(0);
|
|
});
|
|
|
|
it("should not reset nextResupply to 0 when it is not null", () =>
|
|
{
|
|
const pmcProfile = { TradersInfo: { traderId: { nextResupply: 1234 } } };
|
|
|
|
profileFixerService.fixNullTraderNextResupply(pmcProfile);
|
|
|
|
expect(pmcProfile.TradersInfo.traderId.nextResupply).toBe(1234);
|
|
});
|
|
});
|
|
});
|