diff --git a/project/tests/RepairHelper.test.ts b/project/tests/RepairHelper.test.ts index 4cdbfc86..a6c0636c 100644 --- a/project/tests/RepairHelper.test.ts +++ b/project/tests/RepairHelper.test.ts @@ -6,7 +6,6 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { RandomUtil } from "@spt-aki/utils/RandomUtil"; import { TestHelper } from "./common/TestHelper"; @@ -16,7 +15,6 @@ let logger: ILogger; let jsonUtil: JsonUtil; let randomUtil: RandomUtil; let configServer: ConfigServer; -let localisationService: LocalisationService; let databaseServer: DatabaseServer; let helper: RepairHelper; @@ -28,7 +26,6 @@ describe("BotHelper", () => { jsonUtil = testHelper.getTestJsonUtil(); randomUtil = testHelper.getTestRandomUtil(); configServer = testHelper.getTestConfigServer(); - localisationService = testHelper.getTestLocalisationService(); databaseServer = testHelper.getTestDatabaseServer(); }) @@ -46,7 +43,7 @@ describe("BotHelper", () => { expect(helper).toBeInstanceOf(RepairHelper); }); - it("updateItemDurability() repairkit with slick armor with max dura degredation", () => + it("updateItemDurability() repairkit with slick armor with max dura degradation", () => { const slickTpl = "5e4abb5086f77406975c9342"; const itemToRepair: Item = { @@ -69,7 +66,7 @@ describe("BotHelper", () => { expect(itemToRepair.upd?.Repairable?.Durability).toBeLessThan(80); }); - it("updateItemDurability() trader with slick armor with max dura degredation - partial repair", () => + it("updateItemDurability() trader with slick armor with max dura degradation - partial repair", () => { const slickTpl = "5e4abb5086f77406975c9342"; const itemToRepair: Item = { @@ -90,10 +87,10 @@ describe("BotHelper", () => { helper.updateItemDurability(itemToRepair, itemToRepairDetails, isArmor, 5, useRepairKit, 1.2, useDegridation); expect(itemToRepair.upd?.Repairable?.Durability).toBeLessThan(80); - expect(itemToRepair.upd?.Repairable?.Durability).toBeGreaterThan(60); + expect(itemToRepair.upd?.Repairable?.Durability).toBeLessThanOrEqual(itemToRepair.upd?.Repairable?.MaxDurability); }); - it("updateItemDurability() trader with slick armor, no dura degredation", () => + it("updateItemDurability() trader with slick armor, no dura degradation", () => { const slickTpl = "5e4abb5086f77406975c9342"; const itemToRepair: Item = { @@ -109,15 +106,15 @@ describe("BotHelper", () => { const itemToRepairDetails = databaseServer.getTables().templates?.items[slickTpl]; const isArmor = true; const useRepairKit = false; - const useDegridation = false; + const useDegradation = false; - helper.updateItemDurability(itemToRepair, itemToRepairDetails, isArmor, 20, useRepairKit, 1.2, useDegridation); + helper.updateItemDurability(itemToRepair, itemToRepairDetails, isArmor, 20, useRepairKit, 1.2, useDegradation); expect(itemToRepair.upd?.Repairable?.Durability).toBe(80); - expect(itemToRepair.upd?.Repairable?.Durability).toBe(itemToRepair.upd?.Repairable?.MaxDurability); + expect(itemToRepair.upd?.Repairable?.Durability).toBeLessThanOrEqual(itemToRepair.upd?.Repairable?.MaxDurability); }); - it("updateItemDurability() repairkit with g36 with max dura degredation - Full repair", () => + it("updateItemDurability() repairkit with g36 with max dura degradation - Full repair", () => { const itemCurrentDura = 68; const itemCurrentMaxDura = 100; @@ -136,15 +133,15 @@ describe("BotHelper", () => { const itemToRepairDetails = databaseServer.getTables().templates?.items[g36Tpl]; const isArmor = false; const useRepairKit = true; - const useDegridation = true; + const useDegradation = true; - helper.updateItemDurability(itemToRepair, itemToRepairDetails, isArmor, duraDifference, useRepairKit, 1, useDegridation); + helper.updateItemDurability(itemToRepair, itemToRepairDetails, isArmor, duraDifference, useRepairKit, 1, useDegradation); expect(itemToRepair.upd?.Repairable?.Durability).toBeLessThan(100); - expect(itemToRepair.upd?.Repairable?.Durability).toBe(itemToRepair.upd?.Repairable?.MaxDurability); + expect(itemToRepair.upd?.Repairable?.Durability).toBeLessThanOrEqual(itemToRepair.upd?.Repairable?.MaxDurability); }); - it("updateItemDurability() trader with g36 with max dura degredation - Full repair", () => + it("updateItemDurability() trader with g36 with max dura degradation - Full repair", () => { const itemCurrentDura = 68; const itemCurrentMaxDura = 100; @@ -163,15 +160,15 @@ describe("BotHelper", () => { const itemToRepairDetails = databaseServer.getTables().templates?.items[g36Tpl]; const isArmor = false; const useRepairKit = false; - const useDegridation = true; + const useDegradation = true; - helper.updateItemDurability(itemToRepair, itemToRepairDetails, isArmor, duraDifference, useRepairKit, 1.2, useDegridation); + helper.updateItemDurability(itemToRepair, itemToRepairDetails, isArmor, duraDifference, useRepairKit, 1.2, useDegradation); expect(itemToRepair.upd?.Repairable?.Durability).toBeLessThan(100); - expect(itemToRepair.upd?.Repairable?.Durability).toBe(itemToRepair.upd?.Repairable?.MaxDurability); + expect(itemToRepair.upd?.Repairable?.Durability).toBeLessThanOrEqual(itemToRepair.upd?.Repairable?.MaxDurability); }); - it("updateItemDurability() faceshield broken use repairkit with max dura degredation", () => + it("updateItemDurability() faceshield broken use repairkit with max dura degradation", () => { const twExfilBallisticFaceShieldTpl = "5e00cdd986f7747473332240"; const itemToRepair: Item = { @@ -191,13 +188,13 @@ describe("BotHelper", () => { const itemToRepairDetails = databaseServer.getTables().templates?.items[twExfilBallisticFaceShieldTpl]; const isArmor = true; const useRepairKit = true; - const useDegridation = true; + const useDegradation = true; - helper.updateItemDurability(itemToRepair, itemToRepairDetails, isArmor, 5, useRepairKit, 1, useDegridation); + helper.updateItemDurability(itemToRepair, itemToRepairDetails, isArmor, 5, useRepairKit, 1, useDegradation); expect(itemToRepair.upd?.FaceShield?.Hits).toBe(0); expect(itemToRepair.upd?.Repairable?.Durability).toBeLessThan(45); - expect(itemToRepair.upd?.Repairable?.Durability).toBe(itemToRepair.upd?.Repairable?.MaxDurability); + expect(itemToRepair.upd?.Repairable?.Durability).toBeLessThanOrEqual(itemToRepair.upd?.Repairable?.MaxDurability); }); it("isWeaponTemplate() g36 weapon", () =>