fix: apply crystal multiplier to boss rewards, steepen prestige threshold, fix stale upgrade race condition, and fix companion format display
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m6s
CI / Lint, Build & Test (pull_request) Failing after 1m13s

Closes #221
Closes #222
Closes #201
Closes #213
This commit is contained in:
2026-04-06 13:22:15 -07:00
committed by Naomi Carrigan
parent 1c10df88fb
commit 69579e166a
10 changed files with 131 additions and 55 deletions
+57 -1
View File
@@ -8,7 +8,7 @@
* @author Naomi Carrigan
*/
import { describe, expect, it } from "vitest";
import { formatNumber } from "../src/utils/format.js";
import { formatInteger, formatNumber } from "../src/utils/format.js";
describe("formatNumber", () => {
describe("edge cases", () => {
@@ -142,3 +142,59 @@ describe("formatNumber", () => {
});
});
});
describe("formatInteger", () => {
describe("edge cases", () => {
it("should return '0' for NaN", () => {
expect(formatInteger(Number.NaN)).toBe("0");
});
it("should return '0' for Infinity", () => {
expect(formatInteger(Infinity)).toBe("0");
});
it("should format negative integers with a leading minus sign", () => {
expect(formatInteger(-1500)).toBe("-1K");
});
it("should format zero as '0'", () => {
expect(formatInteger(0)).toBe("0");
});
it("should format small integers without decimals", () => {
expect(formatInteger(42)).toBe("42");
});
});
describe("named suffixes", () => {
it("should format thousands with K suffix and no decimals", () => {
expect(formatInteger(1500)).toBe("1K");
});
it("should format millions with M suffix and no decimals", () => {
expect(formatInteger(2_500_000)).toBe("2M");
});
it("should format billions with B suffix", () => {
expect(formatInteger(3_000_000_000)).toBe("3B");
});
it("should format trillions with T suffix", () => {
expect(formatInteger(1e12)).toBe("1T");
});
it("should format quintillions with Qi suffix", () => {
expect(formatInteger(1e18)).toBe("1Qi");
});
});
describe("letter suffixes", () => {
it("should format values >= 1e36 with letter suffix 'a'", () => {
expect(formatInteger(1e36)).toBe("1a");
});
it("should format values >= 1e39 with letter suffix 'b'", () => {
expect(formatInteger(1e39)).toBe("1b");
});
});
});