fix: stabilize competition results flow

This commit is contained in:
dahyeon committed 2026-07-13 13:55:08 +00:00
1 parent 3bd3120eb1
commit a88562b208
20 files changed
+411 -65

No files matched your search

@@ -10,8 +10,9 @@ import type {
TeamId,
} from "@lolympus/contracts";
import {
DOUBLE_ELIMINATION_BRACKET_VIEWPORT_CLASS,
MATCH_PAGE_MAX_WIDTH_CLASS,
createCompetitionBracketLayout,
matchPageMaxWidthClass,
} from "../src/components/competition/competition-display-layout.ts";
import {
createDoubleEliminationBracketLayout,
@@ -83,10 +84,13 @@ test("places the canonical four-team DAG in shared time columns", () => {
assert.equal(nodeFor(layout, ids.GF).lane, "final");
});
test("selects the wide page grid only for double-elimination matches", () => {
assert.equal(matchPageMaxWidthClass("double-elimination"), "max-w-[1600px]");
assert.equal(matchPageMaxWidthClass("pair"), "max-w-5xl");
assert.equal(matchPageMaxWidthClass("round-robin"), "max-w-5xl");
test("keeps the match page narrow and gives only the desktop bracket a wide viewport", () => {
assert.equal(MATCH_PAGE_MAX_WIDTH_CLASS, "max-w-5xl");
assert.match(DOUBLE_ELIMINATION_BRACKET_VIEWPORT_CLASS, /max-w-\[1600px\]/);
assert.match(
DOUBLE_ELIMINATION_BRACKET_VIEWPORT_CLASS,
/w-\[calc\(100vw-3rem\)\]/,
);
});
test("selects the bracket only for a coherent double-elimination snapshot", () => {
@@ -3,8 +3,20 @@ import test from "node:test";
import {
getTeamProgressErrorContent,
isConsistentTeamProgressSnapshot,
shouldOfferTeamSelection,
} from "../src/pages/match-team-progress-state.ts";
test("offers team selection when the caller cannot be resolved to a team", () => {
assert.equal(shouldOfferTeamSelection([{ status: 401 }], undefined), true);
assert.equal(shouldOfferTeamSelection([{ status: 403 }], undefined), true);
});
test("does not offer team selection once a team is named or the failure is unrelated", () => {
assert.equal(shouldOfferTeamSelection([{ status: 401 }], "team-a"), false);
assert.equal(shouldOfferTeamSelection([{ status: 404 }], undefined), false);
assert.equal(shouldOfferTeamSelection([{ status: 503 }], undefined), false);
});
test("only accepts Competition and team snapshots with the same revision", () => {
assert.equal(
isConsistentTeamProgressSnapshot({ revision: 7 }, { revision: 7 }),