import { expect, test } from "@playwright/test"; import { getSetCookies } from "../helpers/auth-assertions.ts"; test.describe("Logout Route", () => { test("GET /auth/logout always redirects home and clears cookies", async ({ request }) => { const response = await request.get("/auth/logout", { maxRedirects: 0 }); expect(response.status()).toBe(302); expect(response.headers()["location"]).toBe("/"); const cookies = getSetCookies(response).join("\n"); expect(cookies).toContain("session="); expect(cookies).toContain("xx_state_id="); }); test("POST /auth/logout matches GET behavior", async ({ request }) => { const response = await request.post("/auth/logout", { maxRedirects: 0 }); expect(response.status()).toBe(302); expect(response.headers()["location"]).toBe("/"); const cookies = getSetCookies(response).join("\n"); expect(cookies).toContain("session="); expect(cookies).toContain("xx_state_id="); }); });