diff --git a/frontend/e2e/health-check.spec.ts b/frontend/e2e/health-check.spec.ts new file mode 100644 index 0000000..03e2f29 --- /dev/null +++ b/frontend/e2e/health-check.spec.ts @@ -0,0 +1,33 @@ +/** + * E2E: Health check endpoint verification + * + * Tests that: + * 1. GET /api/health returns 200 with { status: "ok" } + * 2. The endpoint is publicly accessible (no auth required) + */ + +import { test, expect } from "@playwright/test"; + +test.describe("Health Check Endpoint", () => { + test("GET /api/health returns status ok", async ({ request }) => { + const response = await request.get("/api/health"); + + expect(response.status()).toBe(200); + + const body = await response.json(); + expect(body).toEqual({ status: "ok" }); + }); + + test("health endpoint is accessible without authentication", async ({ + request, + }) => { + // Make request without any auth headers/cookies + const response = await request.get("/api/health", { + headers: {}, + }); + + expect(response.status()).toBe(200); + const body = await response.json(); + expect(body.status).toBe("ok"); + }); +}); diff --git a/frontend/src/app/api/health/route.ts b/frontend/src/app/api/health/route.ts new file mode 100644 index 0000000..ee6aa4f --- /dev/null +++ b/frontend/src/app/api/health/route.ts @@ -0,0 +1,5 @@ +import { NextResponse } from "next/server"; + +export async function GET() { + return NextResponse.json({ status: "ok" }); +} diff --git a/frontend/src/lib/auth/mode.ts b/frontend/src/lib/auth/mode.ts index fcf741b..b40fb30 100644 --- a/frontend/src/lib/auth/mode.ts +++ b/frontend/src/lib/auth/mode.ts @@ -166,6 +166,7 @@ export const ROUTE_CONFIG = { "/register", "/verify-request", // For email magic link "/api/auth", + "/api/health", "/pending-approval", "/account-suspended", ],