feat(sponsor): show each driver's car for the heat on overlays and Race Day (1.71.0)
This commit is contained in:
1 parent
8ad2b31488
commit
c4375daa93
12 files changed
+43
-10
No files matched your search
@@ -17,3 +17,8 @@ test("the overlay page passes the whole leaderboard (OBS cuts to its own rows se
|
||||
const source = readFileSync(new URL("../src/misc_views.js", import.meta.url), "utf8");
|
||||
assert.doesNotMatch(source, /buildLeaderboard\(active\)\.slice\(0, 12\)/);
|
||||
});
|
||||
|
||||
test("sponsor heats: the overlay shows the driver's car for this heat", () => {
|
||||
const html = renderOverlayLeaderboard([{ key: "a", driverId: "a", displayName: "Anna", heatCarName: "Rental 2", laps: 3, resultDisplay: "-", bestLapMs: 17500 }], deps);
|
||||
assert.match(html, /overlay-heat-car[^>]*>🚗 Rental 2/);
|
||||
});
|
||||
@@ -1110,3 +1110,19 @@ test("buildLeaderboard: same laps in a finished heat - the lower total time wins
|
||||
assert.equal(rows[1].gap, "+1.000s");
|
||||
}
|
||||
});
|
||||
|
||||
test("sponsor heats: each row carries the car the driver has in this heat, other races none", () => {
|
||||
const competitors = {
|
||||
a: { key: "a", driverId: "a", driverName: "Anna", carId: "c2", carName: "Rental 2", laps: 3, lastLapMs: 18000, bestLapMs: 17500, startTimestamp: 1, lastTimestamp: 60000 },
|
||||
b: { key: "b", driverId: "b", driverName: "Bosse", carId: "own", carName: "Own car", laps: 2, lastLapMs: 19000, bestLapMs: 18500, startTimestamp: 1, lastTimestamp: 50000 },
|
||||
};
|
||||
const deps = {
|
||||
ensureSessionResult: () => ({ competitors }), getSessionTargetMs: () => null, getCompetitorPassings: () => [], isCountedPassing: () => true,
|
||||
getCompetitorElapsedMs, getCompetitorSeedMetric: () => null, getSessionLapWindow: () => ({ minLapMs: 0, maxLapMs: Infinity }),
|
||||
getPassingValidationLabel: () => "", formatSeedMetric: () => "", formatRaceClock: String, formatLeaderboardGap: () => "", formatLapDelta: () => "", formatLap: String, t: (key) => key,
|
||||
};
|
||||
const sponsor = buildLeaderboard({ id: "sp", type: "heat", startMode: "mass", carAssignments: { a: "c2" } }, deps);
|
||||
assert.equal(sponsor.find((row) => row.key === "a").heatCarName, "Rental 2");
|
||||
assert.equal(sponsor.find((row) => row.key === "b").heatCarName, "", "a car not handed out in this heat is not shown");
|
||||
assert.ok(buildLeaderboard({ id: "club", type: "heat", startMode: "mass" }, deps).every((row) => row.heatCarName === ""));
|
||||
});
|
||||
Reference in new issue
Block a user