Server/project/tests/helpers/InRaidHelper.test.ts
Alex d13e86ba46 Rebranding to SPT (!345)
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>
2024-05-21 17:59:04 +00:00

50 lines
1.6 KiB
TypeScript

import "reflect-metadata";
import { container } from "tsyringe";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { InRaidHelper } from "@spt/helpers/InRaidHelper";
import { IPmcData } from "@spt/models/eft/common/IPmcData";
describe("InRaidHelper", () =>
{
let inraidHelper: any;
beforeEach(() =>
{
inraidHelper = container.resolve<InRaidHelper>("InRaidHelper");
});
afterEach(() =>
{
vi.restoreAllMocks();
});
describe("resetSkillPointsEarnedDuringRaid", () =>
{
it("should reset PointsEarnedDuringSession for each skill in profile", () =>
{
const mockProfile = {
Skills: {
Common: [
{ Id: "BotReload", Progress: 160.543, PointsEarnedDuringSession: 42, LastAccess: 1712633904 },
{ Id: "BotSound", Progress: 145.6547, PointsEarnedDuringSession: 42, LastAccess: 1712633904 },
{
Id: "Endurance",
Progress: 223.951157,
PointsEarnedDuringSession: 42,
LastAccess: 1712633904,
},
{ Id: "Strength", Progress: 141.2618, PointsEarnedDuringSession: 42, LastAccess: 1712633904 },
],
},
};
(inraidHelper as any).resetSkillPointsEarnedDuringRaid(<IPmcData>mockProfile);
for (const skill of mockProfile.Skills.Common)
{
expect(skill.PointsEarnedDuringSession).toBe(0);
}
});
});
});