31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import {
|
|
GET,
|
|
OPTIONS,
|
|
} from "../../../../src/app/api/v1/provider-plugin-manifest/route.ts";
|
|
|
|
test("provider plugin manifest route returns JSON-safe manifest", async () => {
|
|
const response = await GET();
|
|
const body = await response.json();
|
|
|
|
assert.equal(response.status, 200);
|
|
assert.equal(response.headers.get("Content-Type"), "application/json");
|
|
assert.equal(body.schemaVersion, 1);
|
|
assert.equal(body.generatedFrom, "open-sse/config/providers");
|
|
assert.ok(body.providers.length > 100);
|
|
assert.ok(body.providers.some((provider: { id: string }) => provider.id === "openai"));
|
|
|
|
const serialized = JSON.stringify(body);
|
|
assert.equal(serialized.includes("clientSecret"), false);
|
|
});
|
|
|
|
test("provider plugin manifest route handles CORS preflight", async () => {
|
|
const response = await OPTIONS();
|
|
|
|
assert.equal(response.status, 200);
|
|
assert.equal(response.headers.get("Access-Control-Allow-Methods"), "GET, OPTIONS");
|
|
assert.equal(response.headers.get("Access-Control-Allow-Headers"), "*");
|
|
});
|