Files
OmniRoute/tests/unit/provider-target-format-badge-4475.test.ts
Diego Rodrigues de Sa e Souza 7c23dab64d Release v3.8.40
v3.8.40 cycle integration → main. All test gates green (Unit/Integration/Coverage/Node-compat/Quality-Ratchet). The only red check, 'PR Test Policy', is the test-masking heuristic firing on the cumulative ~57-commit release diff (legitimate assert consolidations already reviewed per-PR — Gemini CLI removal #5246, retired GPT models #5280, provider catalog refreshes); overridden with --admin per the documented release-PR convention. CodeQL/SonarQube advisory scans non-blocking; #5278's code already passed CodeQL on main. Homologated on VPS 192.168.0.15 (v3.8.40 healthy).
2026-06-29 08:40:06 -03:00

28 lines
1.4 KiB
TypeScript

/**
* Regression for #4475 (feat: targetFormat selector in custom-models form) — Rule #18.
*
* The form is a .tsx, so the testable surface is the pure label-mapping extracted into
* providerPageHelpers.ts. `targetFormatBadgeI18nKey` drives the model-row badge and must
* map exactly the supported targetFormat values to their i18n keys, returning null for
* unknown values (the badge then renders the raw value). Pins the mapping so a future edit
* to the option list can't silently desync the badge from the form's <select> options.
*/
import test from "node:test";
import assert from "node:assert/strict";
import { targetFormatBadgeI18nKey } from "../../src/app/(dashboard)/dashboard/providers/[id]/providerPageHelpers.ts";
test("maps each supported targetFormat value to its i18n key", () => {
assert.equal(targetFormatBadgeI18nKey("openai"), "compatProtocolOpenAI");
assert.equal(targetFormatBadgeI18nKey("openai-responses"), "compatProtocolOpenAIResponses");
assert.equal(targetFormatBadgeI18nKey("claude"), "compatProtocolClaude");
assert.equal(targetFormatBadgeI18nKey("gemini"), "targetFormatGemini");
assert.equal(targetFormatBadgeI18nKey("antigravity"), "targetFormatAntigravity");
});
test("returns null for unknown / empty values (badge falls back to raw value)", () => {
assert.equal(targetFormatBadgeI18nKey(""), null);
assert.equal(targetFormatBadgeI18nKey("bogus"), null);
assert.equal(targetFormatBadgeI18nKey("auto"), null);
});