Files
OmniRoute/tests/unit/provider-endpoints-friendliai-novita.test.ts
Diego Rodrigues de Sa e Souza 0adae00c7b Release v3.8.42 (#5459)
Release v3.8.42 — full CHANGELOG in CHANGELOG.md.

CI: 103 checks green incl. CodeQL (all languages), Semgrep, all 8 unit shards,
coverage, Node 24 compat, and integration tests. Full unit suite validated
locally: 19437 pass / 0 fail. The 3 red checks are advisory and do not gate
main (no required status checks): SonarCloud/SonarQube new-code coverage gate,
and PR Test Policy (test-masking detector flagging the legitimate dead-Phind
provider removal in #5530 — reviewed, correct).

Includes cycle-close reconciliation + repair of inherited base-red tests from
#5480/#5527/#5427/#5521 that the PR->release fast-path did not exercise.
2026-06-30 06:54:29 -03:00

39 lines
1.8 KiB
TypeScript

import test from "node:test";
import assert from "node:assert/strict";
import { friendliaiProvider } from "../../open-sse/config/providers/registry/friendliai/index.ts";
import { novitaProvider } from "../../open-sse/config/providers/registry/novita/index.ts";
// These guards lock in two registry endpoint fixes validated live with real provider keys
// (Hard Rule #18 — real-environment test recorded in the PR):
// - FriendliAI: a serverless `flp_*` token gets 403 Forbidden on the /dedicated path; the
// /serverless path serves it. (#5430)
// - Novita: the legacy /v3 base + the typo'd `ai-ai/…` model id both 404; /openai/v1 + the
// `meta-llama/…` id return a clean OpenAI completion. (#5455)
test("#5430 FriendliAI targets the serverless OpenAI-compatible endpoint, not dedicated", () => {
assert.ok(
friendliaiProvider.baseUrl.includes("/serverless/v1/"),
`baseUrl must use the serverless path, got: ${friendliaiProvider.baseUrl}`
);
assert.ok(
!friendliaiProvider.baseUrl.includes("/dedicated/"),
"baseUrl must not use the dedicated path (403s serverless keys)"
);
assert.equal(friendliaiProvider.modelsUrl, "https://api.friendli.ai/serverless/v1/models");
});
test("#5455 Novita targets the /openai/v1 endpoint with a valid model id", () => {
assert.equal(novitaProvider.baseUrl, "https://api.novita.ai/openai/v1/chat/completions");
assert.equal(novitaProvider.modelsUrl, "https://api.novita.ai/openai/v1/models");
// The `ai-ai/` org does not exist — Novita uses `meta-llama/…`.
assert.ok(
novitaProvider.models.every((m) => !m.id.startsWith("ai-ai/")),
"Novita model ids must not use the non-existent ai-ai/ org"
);
assert.ok(
novitaProvider.models.some((m) => m.id === "meta-llama/llama-3.1-8b-instruct"),
"Novita must list the valid meta-llama/llama-3.1-8b-instruct id"
);
});