fix(e2e): mock GET /reference/ingredients et /profile/disliked-ingredients
preferences.cy.ts échouait en CI (3/4 tests) sur des assertions sans rapport apparent avec le contenu changé cette session (#diet introuvable, 'Arachides' introuvable) : PreferencesPage.tsx charge aussi ces deux endpoints dans le même Promise.all que diets/allergies (pour DislikedIngredientsField), mais le test ne les mockait pas — la requête réseau réelle échoue en CI (pas de backend), le Promise.all rejette, la page entière rend son état d'erreur au lieu du formulaire, ce qui fait disparaître #diet et les cases à cocher d'allergies avec. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
655c10ad95
commit
6f02cc0922
1 changed files with 8 additions and 0 deletions
|
|
@ -28,6 +28,14 @@ describe("Dietary preferences (/parametres/preferences) — hot saving", () => {
|
|||
],
|
||||
});
|
||||
cy.intercept("GET", "**/profile/allergies", { statusCode: 200, body: [2] });
|
||||
// The page also loads the reference ingredient list + the profile's
|
||||
// disliked-ingredients selection for `DislikedIngredientsField` — added
|
||||
// alongside `getDiets`/`getAllergies` in the same `Promise.all` (see
|
||||
// PreferencesPage.tsx), so both need mocking here too or that `Promise.all`
|
||||
// rejects and the whole page renders its error state instead of the form,
|
||||
// taking `#diet`/the allergy checkboxes down with it.
|
||||
cy.intercept("GET", "**/reference/ingredients", { statusCode: 200, body: [] });
|
||||
cy.intercept("GET", "**/profile/disliked-ingredients", { statusCode: 200, body: [] });
|
||||
});
|
||||
|
||||
it("loads the current regime, and shows allergies/intolerances as two groups", () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue