mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-25 20:05:23 -05:00
29 lines
839 B
TypeScript
29 lines
839 B
TypeScript
import { expect, seed, test } from "~/utils/playwright";
|
|
|
|
test.describe("Public API", () => {
|
|
test("OPTIONS preflight request returns 204 with CORS headers", async ({
|
|
page,
|
|
}) => {
|
|
await seed(page);
|
|
|
|
const response = await page.request.fetch("/api/tournament/1", {
|
|
method: "OPTIONS",
|
|
});
|
|
|
|
expect(response.status()).toBe(204);
|
|
expect(response.headers()["access-control-allow-origin"]).toBe("*");
|
|
expect(response.headers()["access-control-allow-methods"]).toContain("GET");
|
|
expect(response.headers()["access-control-allow-headers"]).toContain(
|
|
"Authorization",
|
|
);
|
|
});
|
|
|
|
test("GET request includes CORS headers in response", async ({ page }) => {
|
|
await seed(page);
|
|
|
|
const response = await page.request.fetch("/api/tournament/1");
|
|
|
|
expect(response.headers()["access-control-allow-origin"]).toBe("*");
|
|
});
|
|
});
|