2023-11-05 11:49:20 +01:00
|
|
|
import "reflect-metadata";
|
|
|
|
import { container } from "tsyringe";
|
2023-11-10 23:21:20 +01:00
|
|
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
2024-05-21 19:59:04 +02:00
|
|
|
import { InRaidHelper } from "@spt/helpers/InRaidHelper";
|
|
|
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
2023-11-05 11:49:20 +01:00
|
|
|
|
|
|
|
describe("InRaidHelper", () =>
|
|
|
|
{
|
|
|
|
let inraidHelper: any;
|
|
|
|
|
2023-11-06 20:39:12 +01:00
|
|
|
beforeEach(() =>
|
2023-11-05 11:49:20 +01:00
|
|
|
{
|
|
|
|
inraidHelper = container.resolve<InRaidHelper>("InRaidHelper");
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() =>
|
|
|
|
{
|
|
|
|
vi.restoreAllMocks();
|
|
|
|
});
|
|
|
|
|
2024-04-12 03:07:37 +02:00
|
|
|
describe("resetSkillPointsEarnedDuringRaid", () =>
|
2023-11-05 11:49:20 +01:00
|
|
|
{
|
2024-04-12 03:07:37 +02:00
|
|
|
it("should reset PointsEarnedDuringSession for each skill in profile", () =>
|
2023-11-05 11:49:20 +01:00
|
|
|
{
|
2024-04-12 03:07:37 +02:00
|
|
|
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);
|
|
|
|
}
|
2023-11-05 11:49:20 +01:00
|
|
|
});
|
|
|
|
});
|
2023-11-06 20:39:12 +01:00
|
|
|
});
|