Mobilprofilen visar nu per vald klassom det finns depå,mellantids

decoders
This commit is contained in:
larssand
2026-08-25 20:04:14 +02:00
parent abf887dccd
commit 84302a770d
7 changed files with 81 additions and 2 deletions

View File

@@ -55,6 +55,21 @@ function buildState(now = Date.now()) {
{ driverId: "driver_2", sessionId: "free", timestamp: now - 3000, lapMs: 12000 },
],
},
resultsBySession: {
free: {
splits: [
{ driverId: "driver_1", splitMs: 7200 },
{ driverId: "driver_1", splitMs: 7000 },
{ driverId: "driver_1_4wd", splitMs: 6400 },
{ driverId: "driver_2", splitMs: 6100 },
],
pitStops: [
{ driverId: "driver_1", pitStopMs: 12500, transponder: "secret-transponder-one" },
{ driverId: "driver_1_4wd", pitStopMs: 11000, transponder: "secret-transponder-four" },
{ driverId: "driver_2", pitStopMs: 9500, transponder: "secret-transponder-two" },
],
},
},
};
}
@@ -85,9 +100,20 @@ test("public profile contains only the selected driver's sanitized aggregates",
assert.equal(profile.goals[0].percent, 80);
assert.equal(profile.classProfiles.length, 2);
assert.equal(profile.classProfiles[0].stats.totalLaps, 4);
assert.deepEqual(profile.classProfiles[0].channelStats, {
splitCount: 2,
bestSplitMs: 7000,
averageSplitMs: 7100,
pitStopCount: 1,
totalPitMs: 12500,
bestPitStopMs: 12500,
averagePitStopMs: 12500,
});
assert.equal(profile.classProfiles[1].className, "4WD");
assert.equal(profile.classProfiles[1].stats.totalLaps, 2);
assert.equal(profile.classProfiles[1].stats.bestLapMs, 14000);
assert.equal(profile.classProfiles[1].channelStats.splitCount, 1);
assert.equal(profile.classProfiles[1].channelStats.pitStopCount, 1);
const serialized = JSON.stringify(profile);
assert.equal(serialized.includes("Driver Two"), false);