43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { getAppModelOptions, normalizeCustomModelSlugs } from "./appSettings";
|
|
|
|
describe("normalizeCustomModelSlugs", () => {
|
|
it("normalizes aliases, removes built-ins, and deduplicates values", () => {
|
|
expect(
|
|
normalizeCustomModelSlugs([
|
|
" custom/internal-model ",
|
|
"gpt-5.3-codex",
|
|
"5.3",
|
|
"custom/internal-model",
|
|
"",
|
|
null,
|
|
]),
|
|
).toEqual(["custom/internal-model"]);
|
|
});
|
|
});
|
|
|
|
describe("getAppModelOptions", () => {
|
|
it("appends saved custom models after the built-in options", () => {
|
|
const options = getAppModelOptions(["custom/internal-model"]);
|
|
|
|
expect(options.map((option) => option.slug)).toEqual([
|
|
"gpt-5.3-codex",
|
|
"gpt-5.3-codex-spark",
|
|
"gpt-5.2-codex",
|
|
"gpt-5.2",
|
|
"custom/internal-model",
|
|
]);
|
|
});
|
|
|
|
it("keeps the currently selected custom model available even if it is no longer saved", () => {
|
|
const options = getAppModelOptions([], "custom/selected-model");
|
|
|
|
expect(options.at(-1)).toEqual({
|
|
slug: "custom/selected-model",
|
|
name: "custom/selected-model",
|
|
isCustom: true,
|
|
});
|
|
});
|
|
});
|