mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-03 22:37:06 +02:00
JEST: Update tests related to calculateExp and clampNumber (#2713)
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user