Files
OmniRoute/tests/unit/openrouter-registry.test.mjs
Diego Rodrigues de Sa e Souza 1442c47bbb chore(release): v3.5.6 — email masking, model toggle, OpenRouter registries & bug fixes (#1080)
* fix(minimax): switch auth from x-api-key to Authorization Bearer (#1076)

Integrated into release/v3.5.6 — MiniMax auth fix with authHeader consistency normalization

* feat(CI,i18n): autogenerate language files + Add missing strings (#1071)

Integrated into release/v3.5.6 — i18n translations for memory, skills, and missing keys across 31 languages

* fix(ci): restore i18n continue-on-error, remove auto-commit race condition

* fix(husky): load nvm in hooks for VS Code compatibility

* fix(husky): gracefully skip hooks when npm is not in PATH

* fix: convert OpenAI function tool_choice to Claude tool format (#1072)

* fix: prevent EPIPE feedback loop filling logs at GB/s (#1006)

* fix: fallback to native fetch when undici dispatcher fails (#1054)

* fix: improve Qoder PAT validation with actionable error messages (#966)

- Add QODER_PERSONAL_ACCESS_TOKEN env var fallback for both validation and execution
- Pre-flight ping check to diagnose connectivity issues (Docker/proxy)
- Detect encrypted auth blobs from ~/.qoder/.auth/user and guide to website PAT
- Clear error messages for auth failures with link to integrations page
- Treat non-auth 4xx as auth-pass (request format issue, not token issue)
- Update tests to cover new validation paths (23 tests, all passing)

* feat: Improve the Chinese translation (#1079)

Integrated into release/v3.5.6

* chore(release): v3.5.6 — i18n updates and credential security fixes

* fix(ci): resolve e2e and docs-sync pipeline failures

* fix(security): bump next to 16.2.3 to resolve SNYK-JS-NEXT-15954202

* fix: guard Memory/Cache UI against null toLocaleString crash (#1083)

* fix: translate OpenAI tool_choice type 'function' to Claude 'tool' format (#1072)

* fix: pass custom baseUrl in provider API key validation (#1078)

* docs: update CHANGELOG with v3.5.6 bug fixes and security patches

* docs: rewrite implement-features workflow with 5-phase harvest-research-report-plan-execute pipeline

* docs: organize _ideia/ into viable/defer/notfit + add Phase 2.5 auto-response workflow

* docs: implementation plans for #1025, #750, #960, #1046 + close already-implemented #833, #973, #982

* feat: mask email addresses in dashboard for privacy (#1025)

* feat: add OpenRouter and GitHub to embedding/image provider registries (#960)

* feat: add model visibility toggle and search filter to provider page (#750)

* docs: move implemented features to notfit, update task plans status

* chore: untrack _ideia/ and _tasks/ from git — private/internal only

* chore(release): bump to v3.5.6 — changelog, docs, version sync & any-budget fix

* fix: remove explicit .ts extension in qoderCli import that caused 500 error in production build

---------

Co-authored-by: Jean Brito <jeanfbrito@gmail.com>
Co-authored-by: zenobit <zenobit@disroot.org>
Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>
Co-authored-by: Ethan Hunt <136065060+only4copilot@users.noreply.github.com>
2026-04-09 15:55:59 -03:00

84 lines
3.4 KiB
JavaScript

import { describe, it } from "node:test";
import assert from "node:assert/strict";
import {
getEmbeddingProvider,
parseEmbeddingModel,
getAllEmbeddingModels,
} from "../../open-sse/config/embeddingRegistry.ts";
import {
getImageProvider,
parseImageModel,
} from "../../open-sse/config/imageRegistry.ts";
describe("OpenRouter & GitHub registry entries (#960)", () => {
// ── Embedding Registry ──────────────────────────────────────────────────
describe("embeddingRegistry — openrouter", () => {
it("resolves openrouter provider config", () => {
const p = getEmbeddingProvider("openrouter");
assert.ok(p, "openrouter should be in EMBEDDING_PROVIDERS");
assert.equal(p.baseUrl, "https://openrouter.ai/api/v1/embeddings");
assert.equal(p.authHeader, "bearer");
});
it("openrouter has at least 3 models", () => {
const p = getEmbeddingProvider("openrouter");
assert.ok(p.models.length >= 3, `Expected ≥3 models, got ${p.models.length}`);
});
it("parses openrouter/openai/text-embedding-3-small correctly", () => {
const result = parseEmbeddingModel("openrouter/openai/text-embedding-3-small");
assert.equal(result.provider, "openrouter");
assert.equal(result.model, "openai/text-embedding-3-small");
});
it("openrouter models appear in getAllEmbeddingModels", () => {
const all = getAllEmbeddingModels();
const orModels = all.filter((m) => m.provider === "openrouter");
assert.ok(orModels.length > 0, "Expected openrouter models in full list");
});
});
describe("embeddingRegistry — github", () => {
it("resolves github provider config", () => {
const p = getEmbeddingProvider("github");
assert.ok(p, "github should be in EMBEDDING_PROVIDERS");
assert.equal(p.baseUrl, "https://models.inference.ai.azure.com/embeddings");
assert.equal(p.authHeader, "bearer");
});
it("github has at least 2 models", () => {
const p = getEmbeddingProvider("github");
assert.ok(p.models.length >= 2, `Expected ≥2 models, got ${p.models.length}`);
});
it("parses github/text-embedding-3-small correctly", () => {
const result = parseEmbeddingModel("github/text-embedding-3-small");
assert.equal(result.provider, "github");
assert.equal(result.model, "text-embedding-3-small");
});
});
// ── Image Registry ───────────────────────────────────────────────────────
describe("imageRegistry — openrouter", () => {
it("resolves openrouter image provider config", () => {
const p = getImageProvider("openrouter");
assert.ok(p, "openrouter should be in IMAGE_PROVIDERS");
assert.equal(p.baseUrl, "https://openrouter.ai/api/v1/images/generations");
assert.equal(p.format, "openai");
});
it("openrouter image provider has at least 2 models", () => {
const p = getImageProvider("openrouter");
assert.ok(p.models.length >= 2, `Expected ≥2 models, got ${p.models.length}`);
});
it("parses openrouter/openai/dall-e-3 correctly", () => {
const result = parseImageModel("openrouter/openai/dall-e-3");
assert.equal(result.provider, "openrouter");
assert.equal(result.model, "openai/dall-e-3");
});
});
});