OmniRoute/tests/unit/executor-pollinations.test.ts
diegosouzapw dc6d9e2e4b feat(core): add payload rules, tag routing, and scheduled budgets
Introduce runtime-configurable payload mutation/filter rules with file
reload support and a settings API so upstream request bodies can be
customized per model and protocol without restarts.

Expand search support with Google PSE, Linkup, SearchAPI, and SearXNG,
including validation, routing, analytics costing, MCP schema updates,
and search-type-aware provider selection. Update Pollinations to support
anonymous access, endpoint failover, and the latest public model lineup.

Add OmniRoute response metadata headers/SSE comments, per-connection
model exclusion rules, combo tag-based routing, buffered spend writes,
and scheduled daily/weekly/monthly budget resets. Update model catalog
and dashboard UIs to surface source labels and hide models excluded by
all active connections.
2026-04-17 09:00:32 -03:00

39 lines
1.4 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import { PollinationsExecutor } from "../../open-sse/executors/pollinations.ts";
test("PollinationsExecutor.buildUrl uses the primary endpoint and the gen fallback", () => {
const executor = new PollinationsExecutor();
assert.equal(
executor.buildUrl("openai", true),
"https://text.pollinations.ai/openai/chat/completions"
);
assert.equal(
executor.buildUrl("openai", true, 1),
"https://gen.pollinations.ai/v1/chat/completions"
);
});
test("PollinationsExecutor.buildHeaders supports anonymous access and optional SSE accept", () => {
const executor = new PollinationsExecutor();
assert.deepEqual(executor.buildHeaders({}, true), {
"Content-Type": "application/json",
Accept: "text/event-stream",
});
});
test("PollinationsExecutor.buildHeaders sends API auth for the key-backed tier when configured", () => {
const executor = new PollinationsExecutor();
assert.deepEqual(executor.buildHeaders({ apiKey: "poll-key" }, true), {
"Content-Type": "application/json",
Authorization: "Bearer poll-key",
Accept: "text/event-stream",
});
});
test("PollinationsExecutor.transformRequest is a passthrough for alias models", () => {
const executor = new PollinationsExecutor();
const body = { model: "claude", messages: [{ role: "user", content: "hello" }] };
assert.equal(executor.transformRequest("claude", body, true, {}), body);
});