mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-05 06:42:12 +03:00
Centralize optional API key capability checks so dashboard forms and provider schemas share the same rules, including keyless Pollinations support and cloud-agent batch testing mode. Also align auto-combo config on `routerStrategy`, keep legacy combo reads compatible, preserve MCP routes as management APIs, narrow `require-login` public access to readonly/bootstrap flows, and make cloud-agent CORS reflect the request origin for credentialed requests.
28 lines
859 B
TypeScript
28 lines
859 B
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
const { createProviderSchema, providersBatchTestSchema } =
|
|
await import("../../src/shared/validation/schemas.ts");
|
|
const { providerAllowsOptionalApiKey } = await import("../../src/shared/constants/providers.ts");
|
|
|
|
test("Pollinations is treated as a keyless-capable provider", () => {
|
|
assert.equal(providerAllowsOptionalApiKey("pollinations"), true);
|
|
});
|
|
|
|
test("createProviderSchema allows Pollinations without apiKey", () => {
|
|
const result = createProviderSchema.safeParse({
|
|
provider: "pollinations",
|
|
name: "Pollinations",
|
|
});
|
|
|
|
assert.equal(result.success, true);
|
|
});
|
|
|
|
test("providersBatchTestSchema accepts cloud-agent batch mode", () => {
|
|
const result = providersBatchTestSchema.safeParse({
|
|
mode: "cloud-agent",
|
|
});
|
|
|
|
assert.equal(result.success, true);
|
|
});
|