Catalogue des WOD de référence (lot 4d)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
35a826ddf0
commit
79ce7b34ac
@@ -449,6 +449,22 @@ function check(scheme, cond, msg) {
|
||||
await go("#/analyses");
|
||||
ok(await page.getByText(`Record ${wodTime} · Scaled`).isVisible(), "analyses : record du WOD");
|
||||
|
||||
// ---- WOD de référence (lot 4d) : catalogue, fiche, « Faire aujourd'hui » ----------
|
||||
await go("#/");
|
||||
await page.getByRole("link", { name: /^WOD/ }).click();
|
||||
await settle();
|
||||
ok(await page.locator("h1").textContent() === "Références" && await page.getByRole("link", { name: /Fran · For Time/ }).isVisible(), "catalogue des WOD de référence");
|
||||
await page.getByRole("link", { name: /Cindy · AMRAP 20 min/ }).click();
|
||||
await settle();
|
||||
ok(page.url().endsWith("#/wod/cindy") && await page.getByText("Scaled : ").isVisible(), "fiche de Cindy, avec sa variante scaled");
|
||||
await shot("24-wod-reference", true);
|
||||
await button("Faire aujourd'hui").click();
|
||||
await settle();
|
||||
ok(/#\/seance\/J\d+$/.test(page.url()) && await page.locator(".wod-format__label").textContent() === "AMRAP 20 min", "Faire aujourd'hui : la séance WOD s'ouvre");
|
||||
await go("#/wod/cindy");
|
||||
ok(await button("Reprendre ce WOD").isVisible(), "pas de doublon : le WOD en attente est repris");
|
||||
await page.evaluate(() => localStorage.removeItem("ia-fit.draft"));
|
||||
|
||||
// ---- réinitialisation --------------------------------------------------------------
|
||||
await go("#/donnees");
|
||||
await button("Tout effacer").click();
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { BENCHMARKS, BENCHMARK_FAMILIES, benchmark } from "../../app/domain/benchmarks.js";
|
||||
import { EXERCISES } from "../../app/domain/exercises.js";
|
||||
import { validateProgram, withOneOff } from "../../app/domain/program.js";
|
||||
import { EXAMPLE_PROGRAM } from "../../app/domain/example-program.js";
|
||||
import { buildOnboardingBrief } from "../../app/domain/ai-brief.js";
|
||||
|
||||
test("chaque WOD de référence est une séance WOD valide, aux exercices de la bibliothèque", () => {
|
||||
assert.ok(BENCHMARKS.length >= 12);
|
||||
for (const b of BENCHMARKS) {
|
||||
assert.deepEqual(validateProgram({ name: "P", sessions: [{ ...b.session, key: "J1" }] }), [], b.id);
|
||||
assert.ok(b.session.format, b.id + " : un format");
|
||||
for (const x of b.session.exercises) {
|
||||
assert.ok(x.ref && EXERCISES[x.ref], `${b.id} : ${x.ref} dans la bibliothèque`);
|
||||
assert.equal(x.sets, 1, b.id);
|
||||
}
|
||||
assert.ok(b.family in BENCHMARK_FAMILIES, b.id);
|
||||
assert.ok(b.summary.trim() && b.scaled.trim(), b.id);
|
||||
assert.match(b.id, /^[a-z0-9-]+$/);
|
||||
}
|
||||
assert.equal(new Set(BENCHMARKS.map((b) => b.id)).size, BENCHMARKS.length, "ids uniques");
|
||||
assert.equal(new Set(BENCHMARKS.map((b) => b.session.name.toLowerCase())).size, BENCHMARKS.length, "noms uniques");
|
||||
assert.equal(benchmark("fran")?.session.name, "Fran");
|
||||
assert.equal(benchmark("inconnu"), null);
|
||||
});
|
||||
|
||||
test("un WOD de référence s'ajoute au programme comme WOD ponctuel ; ia.md cite le catalogue", () => {
|
||||
const fran = /** @type {NonNullable<ReturnType<typeof benchmark>>} */ (benchmark("fran"));
|
||||
const { program, key } = withOneOff(EXAMPLE_PROGRAM, fran.session, []);
|
||||
assert.deepEqual(validateProgram(program), []);
|
||||
assert.equal(program.sessions.find((s) => s.key === key)?.name, "Fran");
|
||||
const brief = buildOnboardingBrief({ baseUrl: "https://ia-fit.sans.pub" });
|
||||
for (const b of BENCHMARKS) assert.ok(brief.includes(b.session.name), b.id);
|
||||
});
|
||||
Reference in New Issue
Block a user