add more stats to mobile profile

This commit is contained in:
larssand
2026-09-04 16:17:45 +02:00
parent 142c45be04
commit 4068cc7c19
13 changed files with 267 additions and 22 deletions

View File

@@ -124,6 +124,22 @@ test("public profile contains only the selected driver's sanitized aggregates",
assert.equal(serialized.includes("secret-decoder"), false);
});
test("public profile visibility removes disabled sections from the API payload", () => {
const state = buildState();
state.training.shares[0].visibility = { progress: false, achievements: false, performance: false, goals: false, history: false };
const profile = buildPublicTrainingProfile(state, DRIVER_ONE_TOKEN, "");
const classProfile = profile.classProfiles[0];
assert.deepEqual(profile.visibility, { progress: false, achievements: false, performance: false, goals: false, history: false });
assert.equal(classProfile.goals.length, 0);
assert.deepEqual(classProfile.channelStats, {});
assert.equal("paceHistory" in classProfile.stats, false);
assert.equal("achievements" in classProfile.stats, false);
assert.equal("stintSummaries" in classProfile.stats, false);
assert.equal("dailySummaries" in classProfile.stats, false);
assert.equal(classProfile.stats.totalLaps, 4);
assert.equal(classProfile.stats.bestLapMs, 16000);
});
test("public profile exposes only class-scoped development trends and achievements", () => {
const now = Date.now();
const state = buildState(now);