Spaces:
Paused
Paused
Download tests/e2e/api.spec.ts from igorkurgin/omniroute: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/spaces/igorkurgin/omniroute/resolve/main/tests/e2e/api.spec.ts
- Command line
-
hf download hf://spaces/igorkurgin/omniroute/tests/e2e/api.spec.ts
-
curl -L -o api.spec.ts https://huggingface.co/spaces/igorkurgin/omniroute/resolve/main/tests/e2e/api.spec.ts
1.14 kB
| import { test, expect } from "@playwright/test"; | |
| test.describe("API Health Checks", () => { | |
| test("GET /api/monitoring/health returns OK", async ({ request }) => { | |
| const res = await request.get("/api/monitoring/health"); | |
| expect(res.ok()).toBeTruthy(); | |
| const body = (await res.json()) as any; | |
| expect(body).toHaveProperty("status"); | |
| }); | |
| test("GET /api/v1/models returns model list", async ({ request }) => { | |
| const res = await request.get("/api/v1/models"); | |
| expect(res.ok()).toBeTruthy(); | |
| const body = (await res.json()) as any; | |
| expect(body).toHaveProperty("data"); | |
| expect(Array.isArray(body.data)).toBe(true); | |
| }); | |
| test("GET /api/providers returns provider list or requires auth", async ({ request }) => { | |
| const res = await request.get("/api/providers"); | |
| // In CI with auth enabled, 401 is acceptable — endpoint is reachable | |
| if (res.ok()) { | |
| const body = (await res.json()) as any; | |
| expect(body).toHaveProperty("connections"); | |
| expect(Array.isArray(body.connections)).toBe(true); | |
| } else { | |
| expect([401, 403, 307]).toContain(res.status()); | |
| } | |
| }); | |
| }); | |