// Mocks the API via cy.intercept — see auth.cy.ts for the rationale. const authenticatedProfile = { id: 1, firstName: "Alice", lastName: "Martin", email: "alice@example.com", tokenVersion: 0, houseId: null, dietId: null, }; describe("Sidebar — settings menu and account menu", () => { beforeEach(() => { cy.intercept("GET", "**/auth/me", { statusCode: 200, body: authenticatedProfile }); cy.intercept("GET", "**/planning/current", { statusCode: 200, body: null }); }); it("no longer lists Foyer in the main nav", () => { cy.visit("/"); cy.get(".app-sidebar__nav a").should("not.contain", "Foyer"); }); it("reveals the three settings pages behind the Paramètres toggle", () => { cy.visit("/"); cy.contains("a", "Compte").should("not.exist"); cy.contains("button", "Paramètres").click(); cy.contains("a", "Compte").should("have.attr", "href", "/parametres/compte"); cy.contains("a", "Préférences").should("have.attr", "href", "/parametres/preferences"); cy.contains("a", "Foyer").should("have.attr", "href", "/parametres/foyer"); }); it("opens the account menu from the greeting and links to Mon compte", () => { cy.visit("/"); cy.contains("a", "Mon compte").should("not.exist"); cy.contains("button", "Bonjour Alice").click(); cy.contains("a", "Mon compte").click(); cy.url().should("include", "/parametres/compte"); }); it("redirects the old /foyer path to /parametres/foyer", () => { cy.intercept("GET", "**/house/current", { statusCode: 200, body: null }); cy.visit("/foyer"); cy.url().should("include", "/parametres/foyer"); }); });