WOD ponctuel proposé par l'IA et records par WOD (lot 4c)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
06bd91d797
commit
7dc106837b
@@ -69,7 +69,7 @@ test("initialize, tools/list, notifications et méthodes inconnues", async () =>
|
||||
const list = /** @type {any} */ (await mcp.handle({ jsonrpc: "2.0", id: 2, method: "tools/list" }, syncKey));
|
||||
assert.deepEqual(list.result.tools.map((/** @type {any} */ t) => t.name), [
|
||||
"get_overview", "get_program", "get_training_history", "get_exercise_progress", "get_body_weight",
|
||||
"propose_program", "propose_session_change", "propose_profile",
|
||||
"propose_program", "propose_session_change", "propose_wod", "propose_profile",
|
||||
]);
|
||||
assert.equal((/** @type {any} */ (await mcp.handle({ jsonrpc: "2.0", id: 3, method: "resources/list" }, syncKey))).error.code, -32601);
|
||||
assert.equal((/** @type {any} */ (await mcp.handle({ jsonrpc: "2.0", id: 4, method: "tools/call", params: { name: "rm" } }, syncKey))).error.code, -32602);
|
||||
@@ -170,6 +170,26 @@ test("propose_session_change : une séance d'étirements aux refs inventées dev
|
||||
assert.equal("notices" in (await call("propose_program", { program: EXAMPLE_PROGRAM, reason: "x" })).json, false);
|
||||
});
|
||||
|
||||
test("propose_wod : WOD ponctuel ajouté hors rotation, clé choisie, WOD ponctuels faits retirés", async () => {
|
||||
const wod = { name: "Cindy", format: { type: "amrap", minutes: 20 },
|
||||
exercises: [{ ref: "pull-up", sets: 1, reps: "5", rest: 0 }, { ref: "push-up", sets: 1, reps: "10", rest: 0 }, { ref: "bodyweight-squat", sets: 1, reps: "15", rest: 0 }] };
|
||||
const program = { ...EXAMPLE_PROGRAM, sessions: [...EXAMPLE_PROGRAM.sessions, { ...wod, key: "J1", oneOff: true }] };
|
||||
const events = [...history(), createEvent("ProgramAdopted", { program, source: "ai" }, { device, at: "2026-11-15T10:00:00.000Z" }),
|
||||
createEvent("SessionLogged", { date: "2026-11-16", kind: "strength", ref: "J1", name: "Cindy", warmup: null, exercises: [],
|
||||
wod: { format: wod.format, rx: true, seconds: null, rounds: 14, reps: 3, kg: null, capped: false } }, { device, at: "2026-11-16T19:00:00.000Z" })];
|
||||
const { call, journal } = await setup(events);
|
||||
const overview = (await call("get_overview")).json;
|
||||
assert.deepEqual(overview.program.sessions.find((/** @type {any} */ x) => x.key === "J1"), { key: "J1", name: "Cindy", format: wod.format, oneOff: true, done: true, exercises: ["pull-up 1 × 5", "push-up 1 × 10", "bodyweight-squat 1 × 15"] });
|
||||
const r = await call("propose_wod", { session: { ...wod, name: "Cindy (encore)", key: "A", oneOff: false }, reason: "Un AMRAP pour ce soir" });
|
||||
assert.equal(r.isError, false);
|
||||
assert.equal(r.json.key, "J2", "J1 a déjà servi");
|
||||
const sessions = /** @type {any} */ ((await journal()).at(-1)).data.program.sessions;
|
||||
assert.deepEqual(sessions.map((/** @type {any} */ s) => s.key), [...EXAMPLE_PROGRAM.sessions.map((s) => s.key), "J2"], "J1, faite, est retirée ; la séance A n'est pas touchée");
|
||||
assert.equal(sessions.at(-1).oneOff, true);
|
||||
assert.match((await call("propose_wod", { session: { name: "x", exercises: [] }, reason: "x" })).text, /'session.format' manquant/);
|
||||
assert.match((await call("propose_wod", { session: { ...wod, format: { type: "amrap" } }, reason: "x" })).text, /format.minutes/);
|
||||
});
|
||||
|
||||
test("propose_profile : le programme courant accompagné du nouveau profil ; sans programme, refusé", async () => {
|
||||
const { call, journal } = await setup();
|
||||
const r = await call("propose_profile", { profile: { ...PROFILE, constraints: ["Épaule droite"] }, reason: "Blessure" });
|
||||
|
||||
Reference in New Issue
Block a user