From c177f2486f68608f7899e7f0eceef3865e130b60 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Mon, 21 Sep 2026 20:48:02 -0400 Subject: [PATCH] test(int): scope reservation vehicle and respawn balance assertions to the run - vehicle fixtures are named to sort first so the 50-item name-sorted options window includes them even on a DB crowded with older idle vehicles - the respawn bridge assertion filters to this run's steam ids so leaked rows from aborted runs cannot break exact equality --- tests/int/operation-reservation-options.int.spec.ts | 6 +++++- tests/int/respawn-tickets.int.spec.ts | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/int/operation-reservation-options.int.spec.ts b/tests/int/operation-reservation-options.int.spec.ts index 7573869..9fb0205 100644 --- a/tests/int/operation-reservation-options.int.spec.ts +++ b/tests/int/operation-reservation-options.int.spec.ts @@ -140,7 +140,11 @@ async function makeVehicle(status: "idle" | "assigned"): Promise { const vehicle = await payload.create({ collection: "game-vehicles", data: { - name: `${RUN} vic ${gameVehicleIds.length}`, + // "!" sorts before alphanumerics: the vehicle query serves the top + // MAX_VEHICLES idle vehicles sorted by name, so this keeps this run's + // fixtures inside the served window even on a DB crowded with older + // idle vehicles. + name: `!${RUN} vic ${gameVehicleIds.length}`, type: vehicleBlueprintId, deployedAt: gameStructureIds[0], status, diff --git a/tests/int/respawn-tickets.int.spec.ts b/tests/int/respawn-tickets.int.spec.ts index 4e452e8..919a856 100644 --- a/tests/int/respawn-tickets.int.spec.ts +++ b/tests/int/respawn-tickets.int.spec.ts @@ -248,7 +248,13 @@ describe("Respawn ticket settlement", () => { it("serves steamId-keyed balances above zero to the bridge", async () => { const tickets = await getTicketBalances(payload); - expect(tickets).toEqual({ + // The bridge map covers every member with a positive balance; scope the + // assertion to this run's steam ids so leaked rows from other sessions + // cannot break exact equality. + const runTickets = Object.fromEntries( + Object.entries(tickets).filter(([steamId]) => steamId.startsWith(`${RUN}-`)), + ); + expect(runTickets).toEqual({ [`${RUN}-sid-yes`]: 2, [`${RUN}-sid-tent`]: 0.5, [`${RUN}-sid-no`]: 0.25,