Server/project/tests/helpers/InRaidHelper.test.ts
chomp 687436ab8b update 3.9.0 with 3.8.1 changes (!289)
Co-authored-by: Refringe <me@refringe.com>
Co-authored-by: Dev <dev@dev.sp-tarkov.com>
Co-authored-by: Terkoiz <terkoiz@spt.dev>
Co-authored-by: Refringe <refringe@noreply.dev.sp-tarkov.com>
Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/289
2024-04-15 07:59:33 +00:00

52 lines
1.7 KiB
TypeScript

import "reflect-metadata";
import { container } from "tsyringe";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { InRaidHelper } from "@spt-aki/helpers/InRaidHelper";
import { IPmcData } from "@spt-aki/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);
}
});
});
});