feat: add http smoke tests.

This commit is contained in:
killian-larcher
2026-06-14 17:58:17 +02:00
parent 25689b6e0d
commit f2b7e4bfff
17 changed files with 631 additions and 107 deletions
+25
View File
@@ -0,0 +1,25 @@
import { ApiHttpClient } from "../helpers/http-client";
const baseUrl = process.env.PROJECT_URL;
if (!baseUrl) {
throw new Error("PROJECT_URL is required");
}
describe("api v1 auth middleware", () => {
const client = new ApiHttpClient(baseUrl);
it("rejects missing api keys", async () => {
const { response, json } = await client.request("GET", "/api/v1/agents");
expect(response.status).toBe(401);
expect(json).toEqual({ error: "Missing API key" });
});
it("rejects invalid api keys", async () => {
const { response, json } = await client.request("GET", "/api/v1/agents", undefined, {
"x-api-key": "sk_invalid",
});
expect(response.status).toBe(401);
expect(json).toEqual({ error: "Invalid or expired API key" });
});
});