Files
OmniRoute/tests/unit/executor-pollinations.test.mjs
T
diegosouzapw 592ca9b5c4 fix: remove hardcoded localhost default arg from GET /api/keys, unify coverage to single coverage/ dir, fix test to pass explicit Request
- Remove `new Request('http://localhost/api/keys')` default arg from GET handler in src/app/api/keys/route.ts (line 26)
- Fix api-key-reveal-route.test.mjs to pass explicit Request instead of calling GET() with no args
- Add --output-dir coverage to all c8 scripts in package.json
- Add coverage.reportsDirectory: 'coverage' to vitest.config.ts and vitest.mcp.config.ts
- Fix CHANGELOG.md structure (# Changelog + [Unreleased] to top)
- Remove 30+ stale coverage-* directories from project root
- Coverage: Statements 78.76% | Branches 72.75% | Functions 80.93% | Lines 78.76% (all thresholds passed)
2026-04-05 23:21:08 -03:00

35 lines
1.2 KiB
JavaScript

import test from "node:test";
import assert from "node:assert/strict";
import { PollinationsExecutor } from "../../open-sse/executors/pollinations.ts";
test("PollinationsExecutor.buildUrl uses the free Pollinations endpoint", () => {
const executor = new PollinationsExecutor();
assert.equal(
executor.buildUrl("openai", true),
"https://text.pollinations.ai/openai/chat/completions"
);
});
test("PollinationsExecutor.buildHeaders omits auth when no key is present", () => {
const executor = new PollinationsExecutor();
assert.deepEqual(executor.buildHeaders({}, true), {
"Content-Type": "application/json",
Accept: "text/event-stream",
});
});
test("PollinationsExecutor.buildHeaders supports optional API auth", () => {
const executor = new PollinationsExecutor();
assert.deepEqual(executor.buildHeaders({ apiKey: "poll-key" }, false), {
"Content-Type": "application/json",
Authorization: "Bearer poll-key",
});
});
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);
});