0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:50:43 -05:00

Fixed unit tests

This commit is contained in:
Dev 2024-05-28 19:52:21 +01:00
parent 5bd49ded59
commit b9148514ce
4 changed files with 11 additions and 8 deletions

View File

@ -188,6 +188,7 @@ describe("InsuranceController", () =>
vi.spyOn(insuranceController.itemHelper, "adoptOrphanedItems").mockImplementation(vi.fn());
vi.spyOn(insuranceController, "sendMail").mockImplementation(vi.fn());
vi.spyOn(insuranceController, "removeInsurancePackageFromProfile").mockImplementation(vi.fn());
vi.spyOn(insuranceController.insuranceService.saveServer, "getProfile").mockImplementation(vi.fn());
// Execute the method.
insuranceController.processInsuredItems(insuranceFixture, sessionId);
@ -217,6 +218,8 @@ describe("InsuranceController", () =>
"removeInsurancePackageFromProfile",
).mockImplementation(vi.fn());
vi.spyOn(insuranceController.insuranceService.saveServer, "getProfile").mockReturnValue({});
// Execute the method.
insuranceController.processInsuredItems(insuranceFixture, sessionId);
@ -1231,7 +1234,7 @@ describe("InsuranceController", () =>
const result = insuranceController.rollForDelete(traderId);
// Verify that the result is null.
expect(result).toBe(null);
expect(result).toBe(undefined);
});
});

View File

@ -197,8 +197,8 @@ describe("BotGenerator", () =>
const botRole = "assault";
botGenerator.botConfig.chanceAssaultScavHasPlayerScavName = 100;
botGenerator.databaseServer.getTables().bots.types.usec.firstName = ["player"];
botGenerator.databaseServer.getTables().bots.types.bear.firstName = [];
botGenerator.databaseService.getBots().types.usec.firstName = ["player"];
botGenerator.databaseService.getBots().types.bear.firstName = [];
const mockPlayerProfile = { Info: { Nickname: "Player", Level: 1 } };
vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile);

View File

@ -1040,14 +1040,14 @@ describe("ItemHelper", () =>
const fakeTemplateItem = { _props: { Cartridges: [{}] } };
const result = itemHelper.getRandomCompatibleCaliberTemplateId(fakeTemplateItem as ITemplateItem);
expect(result).toBe(null);
expect(result).toBe(undefined);
});
it("should return null when undefined passed in", () =>
{
const result = itemHelper.getRandomCompatibleCaliberTemplateId(undefined as ITemplateItem);
expect(result).toBe(null);
expect(result).toBe(undefined);
});
it("should log a warning when the template cartridge can not be found", () =>

View File

@ -18,16 +18,16 @@ describe("ProfileFixerService", () =>
describe("FixPmcProfileIssues", () =>
{
it("should reset nextResupply to 0 when it is null", () =>
it("should reset nextResupply to 0 when it is undefined", () =>
{
const pmcProfile = { TradersInfo: { traderId: { nextResupply: null } } };
const pmcProfile = { TradersInfo: { traderId: { nextResupply: undefined } } };
profileFixerService.fixNullTraderNextResupply(pmcProfile);
expect(pmcProfile.TradersInfo.traderId.nextResupply).toBe(0);
});
it("should not reset nextResupply to 0 when it is not null", () =>
it("should not reset nextResupply to 0 when it is not undefined", () =>
{
const pmcProfile = { TradersInfo: { traderId: { nextResupply: 1234 } } };