generated from nhcarrigan/template
fix: apply crystal multiplier to boss rewards, steepen prestige threshold, fix stale upgrade race condition, and fix companion format display
Closes #221 Closes #222 Closes #201 Closes #213
This commit is contained in:
@@ -477,6 +477,28 @@ describe("game route", () => {
|
||||
expect(body.savedAt).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("restores previous upgrades when incoming prestige count is lower (stale post-prestige save)", async () => {
|
||||
const prevUpgrades = [
|
||||
{ id: "click_1", purchased: false, unlocked: true, target: "click", multiplier: 2 },
|
||||
] as GameState["upgrades"];
|
||||
const prevState = makeState({
|
||||
prestige: { count: 1, runestones: 10, productionMultiplier: 1.3, purchasedUpgradeIds: [] },
|
||||
upgrades: prevUpgrades,
|
||||
});
|
||||
const incomingState = makeState({
|
||||
prestige: { count: 0, runestones: 0, productionMultiplier: 1, purchasedUpgradeIds: [] },
|
||||
upgrades: [
|
||||
{ id: "click_1", purchased: true, unlocked: true, target: "click", multiplier: 2 },
|
||||
] as GameState["upgrades"],
|
||||
});
|
||||
vi.mocked(prisma.gameState.findUnique).mockResolvedValueOnce({ state: prevState } as never);
|
||||
vi.mocked(prisma.player.findUnique).mockResolvedValueOnce(makePlayer({ createdAt: Date.now() }) as never);
|
||||
vi.mocked(prisma.player.update).mockResolvedValueOnce({} as never);
|
||||
vi.mocked(prisma.gameState.upsert).mockResolvedValueOnce({} as never);
|
||||
const res = await save({ state: incomingState });
|
||||
expect(res.status).toBe(200);
|
||||
});
|
||||
|
||||
it("validates companion when active companion is legitimately unlocked", async () => {
|
||||
const prevState = makeState();
|
||||
const stateWithCompanion = makeState({
|
||||
|
||||
Reference in New Issue
Block a user