1
0
Fork 0

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
This commit is contained in:
Jason Fraley 2026-09-21 20:48:02 -04:00
parent 5fb619a5cf
commit c177f2486f
2 changed files with 12 additions and 2 deletions

View file

@ -140,7 +140,11 @@ async function makeVehicle(status: "idle" | "assigned"): Promise<number> {
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,

View file

@ -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,