29 lines
1009 B
TypeScript
29 lines
1009 B
TypeScript
|
|
import { test, expect } from "@playwright/test";
|
||
|
|
|
||
|
|
const apiURL = process.env.PLAYWRIGHT_API_URL ?? "http://localhost:5080";
|
||
|
|
|
||
|
|
test.describe("API health", () => {
|
||
|
|
test("GET /health returns 200", async ({ request }) => {
|
||
|
|
const res = await request.get(`${apiURL}/health`);
|
||
|
|
expect(res.ok()).toBeTruthy();
|
||
|
|
const body = await res.json();
|
||
|
|
expect(body.status).toBe("healthy");
|
||
|
|
});
|
||
|
|
|
||
|
|
test("GET /api/public/security-config", async ({ request }) => {
|
||
|
|
const res = await request.get(`${apiURL}/api/public/security-config`);
|
||
|
|
expect(res.ok()).toBeTruthy();
|
||
|
|
const json = await res.json();
|
||
|
|
expect(json.success).toBe(true);
|
||
|
|
expect(json.data).toBeDefined();
|
||
|
|
});
|
||
|
|
|
||
|
|
test("GET /api/public/discover returns list", async ({ request }) => {
|
||
|
|
const res = await request.get(`${apiURL}/api/public/discover?city=تهران`);
|
||
|
|
expect(res.ok()).toBeTruthy();
|
||
|
|
const json = await res.json();
|
||
|
|
expect(json.success).toBe(true);
|
||
|
|
expect(Array.isArray(json.data)).toBe(true);
|
||
|
|
});
|
||
|
|
});
|