feat: comprehensive balance pass (#239)
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m10s
CI / Lint, Build & Test (pull_request) Successful in 1m15s

- fix: boss signature chain maintained through fight results (#148)
- fix: militia cost curve smoothed (100g -> 65g) (#145)
- fix: crystal_shard buffed to epic tier (1.65x/1.2x -> 1.9x/1.3x) (#144)
- fix: click_power recipe ceiling raised and z13-18 progression smoothed (#142)
- close: elder_bark_shield, void_fragment_amulet, soul_bound_catalyst already at target values (#143)
This commit is contained in:
2026-04-06 19:15:48 -07:00
committed by Naomi Carrigan
parent e7164257c5
commit e742c3a6ef
8 changed files with 84 additions and 11 deletions
+31
View File
@@ -340,6 +340,37 @@ describe("boss route", () => {
expect(area?.status).toBe("locked");
});
it("includes HMAC signature in response when ANTI_CHEAT_SECRET is set", async () => {
process.env.ANTI_CHEAT_SECRET = "test_secret";
const state = makeState({
bosses: [makeBoss()] as GameState["bosses"],
adventurers: [makeAdventurer()] as GameState["adventurers"],
zones: [],
});
vi.mocked(prisma.gameState.findUnique).mockResolvedValueOnce({ state } as never);
vi.mocked(prisma.gameState.update).mockResolvedValueOnce({} as never);
const res = await challenge({ bossId: "test_boss" });
expect(res.status).toBe(200);
const body = await res.json() as { signature: string | undefined };
expect(body.signature).toBeDefined();
delete process.env.ANTI_CHEAT_SECRET;
});
it("omits signature in response when ANTI_CHEAT_SECRET is not set", async () => {
delete process.env.ANTI_CHEAT_SECRET;
const state = makeState({
bosses: [makeBoss()] as GameState["bosses"],
adventurers: [makeAdventurer()] as GameState["adventurers"],
zones: [],
});
vi.mocked(prisma.gameState.findUnique).mockResolvedValueOnce({ state } as never);
vi.mocked(prisma.gameState.update).mockResolvedValueOnce({} as never);
const res = await challenge({ bossId: "test_boss" });
expect(res.status).toBe(200);
const body = await res.json() as { signature: string | undefined };
expect(body.signature).toBeUndefined();
});
it("returns 500 when the database throws", async () => {
vi.mocked(prisma.gameState.findUnique).mockRejectedValueOnce(new Error("DB error"));
const res = await challenge({ bossId: "test_boss" });