batchCooking/apps/api/features/step-definitions/preferences.steps.ts
Nicolas 3acde696f5 API: module preferences — GET/PATCH /preferences (step 2/4)
- getPreferences: SYSTEM par défaut si aucune ligne (même logique que
  dietId/allergies : absent = valeur par défaut, pas une omission)
- updatePreferences: upsert (crée la ligne au premier PATCH)
- Tests Mocha + Cucumber : 401, valeur invalide, défaut, création à la
  volée, cloisonnement entre profils
2026-08-17 15:55:45 +02:00

15 lines
601 B
TypeScript

import assert from "node:assert/strict";
import { Then, When } from "@cucumber/cucumber";
import type { CustomWorld } from "../support/world.js";
When("I request my preferences", async function (this: CustomWorld) {
this.response = await this.agent.get("/preferences");
});
When("I set my theme preference to {string}", async function (this: CustomWorld, theme: string) {
this.response = await this.agent.patch("/preferences").send({ theme });
});
Then("my theme preference should be {string}", function (this: CustomWorld, theme: string) {
assert.equal(this.response.body.theme, theme);
});