mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-26 17:12:27 +03:00
Cherry-picked the value commit (0e918816) onto the current tip, dropping the stale base-red sync commits. Focused tests: pollinations-api-key-required 1/1 plus the whole optional-key suite 142/142 (two legacy assertions in provider-route-schemas flipped to the new key-required contract, commented with the PR). Fixes #11096 — Pollinations answers 401 anonymously now. Thank you @rqzbeh!
30 lines
999 B
TypeScript
30 lines
999 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");
|
|
|
|
// #11117: Pollinations no longer serves anonymous requests (401 without a key),
|
|
// so it left EXPLICIT_OPTIONAL_APIKEY_PROVIDER_IDS — key is now required.
|
|
test("Pollinations requires an API key", () => {
|
|
assert.equal(providerAllowsOptionalApiKey("pollinations"), false);
|
|
});
|
|
|
|
test("createProviderSchema rejects Pollinations without apiKey", () => {
|
|
const result = createProviderSchema.safeParse({
|
|
provider: "pollinations",
|
|
name: "Pollinations",
|
|
});
|
|
|
|
assert.equal(result.success, false);
|
|
});
|
|
|
|
test("providersBatchTestSchema accepts cloud-agent batch mode", () => {
|
|
const result = providersBatchTestSchema.safeParse({
|
|
mode: "cloud-agent",
|
|
});
|
|
|
|
assert.equal(result.success, true);
|
|
});
|