Files
OmniRoute/tests/unit/provider-route-schemas.test.ts
Rouzbeh† 3157e8a7ad fix(providers): require API key for Pollinations and fix optional key i18n labels (#11096) (#11117)
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!
2026-08-22 15:59:31 -03:00

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);
});