JEST: Update tests related to calculateExp and clampNumber (#2713)

This commit is contained in:
catloversg
2026-05-02 05:24:19 +07:00
committed by GitHub
parent f4c4b17797
commit 8751c55a09
+6 -1
View File
@@ -1,3 +1,4 @@
import { CONSTANTS } from "../../../src/Constants";
import { calculateSkill, calculateExp } from "../../../src/PersonObjects/formulas/skill";
describe("calculateSkill", () => {
@@ -18,7 +19,11 @@ describe("calculateSkill", () => {
expect(calculateSkill(calculateExp(skill, 3.3), 3.3)).toBe(skill);
});
test("Special cases", () => {
expect(() => calculateExp(NaN)).toThrow();
if (CONSTANTS.isDevBranch) {
expect(() => calculateExp(NaN)).toThrow();
} else {
expect(calculateExp(NaN)).toBe(0);
}
expect(calculateExp(Infinity)).toBe(Number.MAX_VALUE);
expect(calculateExp(-Infinity)).toBe(0);