- apps/api: les tests Planning (mocha et cucumber) lisaient l'horloge
systeme (new Date()/DateTime.utc()) pour construire leurs fixtures et
interroger /planning, ce qui les rendait non deterministes. Ajoute
test-support/reference-date.ts (TEST_REFERENCE_DATE, une date UTC
fixe) et l'utilise dans planning.test.ts / planning.steps.ts a la
place du systeme.
- apps/web: nouveau style global pour tous les radio/checkbox de
l'app (theme-select, allergy-select, onboarding) - "carte
selectionnable" : le controle natif reste reel/accessible mais
visuellement cache, toute la ligne devient la surface interactive
(bordure + fond teinte + coche au survol/selection). Corrige au
passage le bug de fond qui causait le desalignement des radios sur
/parametres/preferences-utilisateur (la regle generique
input, select { width: 100% } de profile-forms.scss s'appliquait
aussi aux checkbox/radio) et une regression de font-weight ou les
lignes non selectionnees du theme apparaissaient en gras comme si
elles l'etaient.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
58 lines
2.5 KiB
TypeScript
58 lines
2.5 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { Given, Then, When } from "@cucumber/cucumber";
|
|
import { prisma } from "../../src/db/prisma.js";
|
|
import { TEST_REFERENCE_DATE } from "../../test-support/reference-date.js";
|
|
import type { CustomWorld } from "../support/world.js";
|
|
|
|
/** `GET /planning` takes `?date=` explicitly — this scenario wording ("the current planning") maps to the fixed test "today" (see `TEST_REFERENCE_DATE`). */
|
|
When("I request the current planning", async function (this: CustomWorld) {
|
|
this.response = await this.agent
|
|
.get("/planning")
|
|
.query({ date: TEST_REFERENCE_DATE.toISODate() });
|
|
});
|
|
|
|
Then("the current planning response should be empty", function (this: CustomWorld) {
|
|
assert.equal(this.response.body, null);
|
|
});
|
|
|
|
// Creates the planning/recipe rows directly via Prisma rather than through
|
|
// the API — there's no "create a planning" endpoint yet (see
|
|
// specs/batch-cooking-architecture.md, "Calcul batch-cooking" is still
|
|
// TODO), so this is the only way to get a household into a state where it
|
|
// has one. A household is no longer created implicitly at signup, so this
|
|
// step creates one via `POST /house` first — the scenario never names it
|
|
// explicitly, its name doesn't matter here.
|
|
Given(
|
|
"my household has a planning covering today with recipe {string} on {string} for {string}",
|
|
async function (this: CustomWorld, recipeName: string, weekDay: string, meal: string) {
|
|
const houseRes = await this.agent.post("/house").send({ name: "Foyer de test" });
|
|
const houseId: number = houseRes.body.id;
|
|
|
|
const recipe = await prisma.recipe.create({ data: { name: recipeName } });
|
|
const planning = await prisma.planning.create({
|
|
data: {
|
|
houseId,
|
|
startDate: TEST_REFERENCE_DATE.minus({ days: 2 }).toJSDate(),
|
|
finishDate: TEST_REFERENCE_DATE.plus({ days: 2 }).toJSDate(),
|
|
},
|
|
});
|
|
await prisma.planningItem.create({
|
|
data: { planningId: planning.id, weekDay, meal, recipeId: recipe.id },
|
|
});
|
|
},
|
|
);
|
|
|
|
Then(
|
|
"the current planning response should include recipe {string} on {string} for {string}",
|
|
function (this: CustomWorld, recipeName: string, weekDay: string, meal: string) {
|
|
const items = this.response.body.items as Array<{
|
|
weekDay: string;
|
|
meal: string;
|
|
recipe: { name: string };
|
|
}>;
|
|
const item = items.find((i) => i.recipe.name === recipeName);
|
|
assert.ok(item, `expected an item with recipe "${recipeName}", got ${JSON.stringify(items)}`);
|
|
assert.equal(item.weekDay, weekDay);
|
|
assert.equal(item.meal, meal);
|
|
},
|
|
);
|