fix(race): finish the lap you are on, one clock owner, edits survive refresh, participants editable (1.59.0)
This commit is contained in:
1 parent
afb8829b16
commit
db6a9f19e4
16 files changed
+313
-39
No files matched your search
@@ -51,15 +51,40 @@ test("session timer emits each race-audio clock marker once without changing fin
|
||||
setLastFinishAnnouncementSessionId: () => {},
|
||||
announceRaceFinished: () => announced.push("race_finished"),
|
||||
announceRaceClockEvent: (key) => announced.push(key),
|
||||
getFinishWait: () => wait,
|
||||
now: () => clock,
|
||||
});
|
||||
let clock = 1_000_000;
|
||||
let wait = { allFinished: false, closeAt: clock + 20_000 };
|
||||
run(); run();
|
||||
remainingMs = 29_000; run();
|
||||
remainingMs = 9_000; run();
|
||||
remainingMs = 0; run();
|
||||
assert.deepEqual(announced, ["one_minute_remaining", "thirty_seconds_remaining", "ten_seconds_remaining", "time_expired", "final_lap"]);
|
||||
assert.equal(active.status, "running");
|
||||
remainingMs = 0; run(); run();
|
||||
assert.deepEqual(announced, ["one_minute_remaining", "thirty_seconds_remaining", "ten_seconds_remaining", "time_expired"], "said once, and no separate 'final lap'");
|
||||
assert.equal(active.status, "running", "waits for the cars to finish their lap");
|
||||
assert.ok(active.followUpStartedAt);
|
||||
assert.equal(active.finishWaitUntil, wait.closeAt);
|
||||
assert.ok(saves >= 4);
|
||||
wait = { allFinished: true, closeAt: null }; run();
|
||||
assert.equal(active.status, "finished", "closes as soon as every car has crossed after its time");
|
||||
assert.deepEqual(announced.slice(-1), ["race_finished"]);
|
||||
});
|
||||
|
||||
test("session timer: a car still out closes the heat at the wait limit; other windows stay quiet", () => {
|
||||
const make = () => ({ id: "s2", eventId: "e1", type: "qualification", status: "running", startedAt: 1, followUpSec: 10, audioAnnouncements: [] });
|
||||
const deps = (active, extra) => ({
|
||||
getActiveSession: () => active, isUntimedSession: () => false,
|
||||
getSessionTiming: () => ({ remainingMs: 0, targetMs: 300_000 }), saveState: () => {},
|
||||
getLastFinishAnnouncementSessionId: () => null, setLastFinishAnnouncementSessionId: () => {},
|
||||
announceRaceFinished: () => {}, announceRaceClockEvent: (key) => extra.announced.push(key), ...extra.deps,
|
||||
});
|
||||
const owner = make(); const ownerLog = { announced: [], deps: { getFinishWait: () => ({ allFinished: false, closeAt: 50_000 }), now: () => 50_001 } };
|
||||
handleSessionTimerTickHelper(deps(owner, ownerLog));
|
||||
assert.equal(owner.status, "finished");
|
||||
const other = make(); const otherLog = { announced: [], deps: { isClockOwner: () => false, now: () => 310_000 } };
|
||||
handleSessionTimerTickHelper(deps(other, otherLog));
|
||||
assert.deepEqual(otherLog.announced, [], "a second window never calls the clock");
|
||||
assert.equal(other.status, "running", "and leaves closing the heat to the race browser");
|
||||
});
|
||||
|
||||
test("race audio can ignore a mismatched configured voice and select the announcement language", () => {
|
||||
|
||||
Reference in new issue
Block a user