Files
OmniRoute/tests/unit/model-supported-endpoints.test.ts
Diego Rodrigues de Sa e Souza b4ec7807ab Release v3.8.50
Release v3.8.50 — see CHANGELOG.md for the full entry.
2026-08-26 14:25:01 -03:00

59 lines
1.8 KiB
TypeScript

import assert from "node:assert/strict";
import test from "node:test";
import {
classifyModelSupportedEndpoints,
MODEL_SUPPORTED_ENDPOINT_VALUES,
normalizeModelSupportedEndpoints,
} from "../../src/shared/constants/modelSupportedEndpoints.ts";
test("normalizes legacy video and audio metadata to operation-specific endpoint ids", () => {
assert.deepEqual(normalizeModelSupportedEndpoints(["chat", "video", "audio"]), [
"chat",
"videos",
"audio-speech",
"audio-transcriptions",
]);
});
test("deduplicates canonical endpoint ids while preserving order", () => {
assert.deepEqual(
normalizeModelSupportedEndpoints([
"videos",
"video",
"audio-speech",
"audio",
"audio-transcriptions",
]),
["videos", "audio-speech", "audio-transcriptions"]
);
});
test("exports operation-specific values accepted by model metadata", () => {
assert.ok(MODEL_SUPPORTED_ENDPOINT_VALUES.includes("videos"));
assert.ok(MODEL_SUPPORTED_ENDPOINT_VALUES.includes("audio-speech"));
assert.ok(MODEL_SUPPORTED_ENDPOINT_VALUES.includes("audio-transcriptions"));
});
test("preserves endpoint ids introduced by external discovery", () => {
assert.deepEqual(normalizeModelSupportedEndpoints(["responses", "video"]), [
"responses",
"videos",
]);
});
test("classifies operation-specific media endpoints for the model catalog", () => {
assert.deepEqual(classifyModelSupportedEndpoints(["videos"]), { type: "video" });
assert.deepEqual(classifyModelSupportedEndpoints(["audio-speech"]), {
type: "audio",
subtype: "speech",
});
assert.deepEqual(classifyModelSupportedEndpoints(["audio-transcriptions"]), {
type: "audio",
subtype: "transcription",
});
assert.deepEqual(classifyModelSupportedEndpoints(["audio-speech", "audio-transcriptions"]), {
type: "audio",
});
});