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:
parent
5bd49ded59
commit
b9148514ce
@ -188,6 +188,7 @@ describe("InsuranceController", () =>
|
|||||||
vi.spyOn(insuranceController.itemHelper, "adoptOrphanedItems").mockImplementation(vi.fn());
|
vi.spyOn(insuranceController.itemHelper, "adoptOrphanedItems").mockImplementation(vi.fn());
|
||||||
vi.spyOn(insuranceController, "sendMail").mockImplementation(vi.fn());
|
vi.spyOn(insuranceController, "sendMail").mockImplementation(vi.fn());
|
||||||
vi.spyOn(insuranceController, "removeInsurancePackageFromProfile").mockImplementation(vi.fn());
|
vi.spyOn(insuranceController, "removeInsurancePackageFromProfile").mockImplementation(vi.fn());
|
||||||
|
vi.spyOn(insuranceController.insuranceService.saveServer, "getProfile").mockImplementation(vi.fn());
|
||||||
|
|
||||||
// Execute the method.
|
// Execute the method.
|
||||||
insuranceController.processInsuredItems(insuranceFixture, sessionId);
|
insuranceController.processInsuredItems(insuranceFixture, sessionId);
|
||||||
@ -217,6 +218,8 @@ describe("InsuranceController", () =>
|
|||||||
"removeInsurancePackageFromProfile",
|
"removeInsurancePackageFromProfile",
|
||||||
).mockImplementation(vi.fn());
|
).mockImplementation(vi.fn());
|
||||||
|
|
||||||
|
vi.spyOn(insuranceController.insuranceService.saveServer, "getProfile").mockReturnValue({});
|
||||||
|
|
||||||
// Execute the method.
|
// Execute the method.
|
||||||
insuranceController.processInsuredItems(insuranceFixture, sessionId);
|
insuranceController.processInsuredItems(insuranceFixture, sessionId);
|
||||||
|
|
||||||
@ -1231,7 +1234,7 @@ describe("InsuranceController", () =>
|
|||||||
const result = insuranceController.rollForDelete(traderId);
|
const result = insuranceController.rollForDelete(traderId);
|
||||||
|
|
||||||
// Verify that the result is null.
|
// Verify that the result is null.
|
||||||
expect(result).toBe(null);
|
expect(result).toBe(undefined);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -197,8 +197,8 @@ describe("BotGenerator", () =>
|
|||||||
const botRole = "assault";
|
const botRole = "assault";
|
||||||
|
|
||||||
botGenerator.botConfig.chanceAssaultScavHasPlayerScavName = 100;
|
botGenerator.botConfig.chanceAssaultScavHasPlayerScavName = 100;
|
||||||
botGenerator.databaseServer.getTables().bots.types.usec.firstName = ["player"];
|
botGenerator.databaseService.getBots().types.usec.firstName = ["player"];
|
||||||
botGenerator.databaseServer.getTables().bots.types.bear.firstName = [];
|
botGenerator.databaseService.getBots().types.bear.firstName = [];
|
||||||
|
|
||||||
const mockPlayerProfile = { Info: { Nickname: "Player", Level: 1 } };
|
const mockPlayerProfile = { Info: { Nickname: "Player", Level: 1 } };
|
||||||
vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile);
|
vi.spyOn(botGenerator.profileHelper, "getPmcProfile").mockReturnValue(<IPmcData>mockPlayerProfile);
|
||||||
|
@ -1040,14 +1040,14 @@ describe("ItemHelper", () =>
|
|||||||
const fakeTemplateItem = { _props: { Cartridges: [{}] } };
|
const fakeTemplateItem = { _props: { Cartridges: [{}] } };
|
||||||
const result = itemHelper.getRandomCompatibleCaliberTemplateId(fakeTemplateItem as ITemplateItem);
|
const result = itemHelper.getRandomCompatibleCaliberTemplateId(fakeTemplateItem as ITemplateItem);
|
||||||
|
|
||||||
expect(result).toBe(null);
|
expect(result).toBe(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return null when undefined passed in", () =>
|
it("should return null when undefined passed in", () =>
|
||||||
{
|
{
|
||||||
const result = itemHelper.getRandomCompatibleCaliberTemplateId(undefined as ITemplateItem);
|
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", () =>
|
it("should log a warning when the template cartridge can not be found", () =>
|
||||||
|
@ -18,16 +18,16 @@ describe("ProfileFixerService", () =>
|
|||||||
|
|
||||||
describe("FixPmcProfileIssues", () =>
|
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);
|
profileFixerService.fixNullTraderNextResupply(pmcProfile);
|
||||||
|
|
||||||
expect(pmcProfile.TradersInfo.traderId.nextResupply).toBe(0);
|
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 } } };
|
const pmcProfile = { TradersInfo: { traderId: { nextResupply: 1234 } } };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user