Files
lolympus-tournament-support/apps/web/test/internal-match-game-selection.test.ts
dahyeon 3bd3120eb1 feat: link competition games to detail analysis
Route each result-history Game by its global display number and preserve the Competition return target. Refuse stale detail fallbacks so a missing requested Game cannot silently show another Game.
2026-07-13 10:41:44 +00:00

14 lines
592 B
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import { selectInternalMatchGame } from "../src/lib/internal-match-game-selection.ts";
test("selects only the Game explicitly requested by its global number", () => {
const firstGame = { gameNumber: 1, id: "first" };
const requestedGame = { gameNumber: 17, id: "requested" };
const games = [firstGame, requestedGame];
assert.equal(selectInternalMatchGame(games, 17), requestedGame);
assert.equal(selectInternalMatchGame(games, 99), null);
assert.equal(selectInternalMatchGame(games, Number.NaN), null);
});