Open History to see the last commit
1import { describe, expect, it } from "vitest";
2
3import {
4 DEFAULT_TIMESTAMP_FORMAT,
5 getAppModelOptions,
6 normalizeCustomModelSlugs,
7 resolveAppModelSelection,
8} from "./appSettings";
9
10describe("normalizeCustomModelSlugs", () => {
11 it("normalizes aliases, removes built-ins, and deduplicates values", () => {
12 expect(
13 normalizeCustomModelSlugs([
14 " custom/internal-model ",
15 "gpt-5.3-codex",
16 "5.3",
17 "custom/internal-model",
18 "",
19 null,
20 ]),
21 ).toEqual(["custom/internal-model"]);
22 });
23});
24
25describe("getAppModelOptions", () => {
26 it("appends saved custom models after the built-in options", () => {
27 const options = getAppModelOptions("codex", ["custom/internal-model"]);
28
29 expect(options.map((option) => option.slug)).toEqual([
30 "gpt-5.4",
31 "gpt-5.3-codex",
32 "gpt-5.3-codex-spark",
33 "gpt-5.2-codex",
34 "gpt-5.2",
35 "custom/internal-model",
36 ]);
37 });
38
39 it("keeps the currently selected custom model available even if it is no longer saved", () => {
40 const options = getAppModelOptions("codex", [], "custom/selected-model");
41
42 expect(options.at(-1)).toEqual({
43 slug: "custom/selected-model",
44 name: "custom/selected-model",
45 isCustom: true,
46 });
47 });
48});
49
50describe("resolveAppModelSelection", () => {
51 it("preserves saved custom model slugs instead of falling back to the default", () => {
52 expect(resolveAppModelSelection("codex", ["galapagos-alpha"], "galapagos-alpha")).toBe(
53 "galapagos-alpha",
54 );
55 });
56
57 it("falls back to the provider default when no model is selected", () => {
58 expect(resolveAppModelSelection("codex", [], "")).toBe("gpt-5.4");
59 });
60});
61
62describe("timestamp format defaults", () => {
63 it("defaults timestamp format to locale", () => {
64 expect(DEFAULT_TIMESTAMP_FORMAT).toBe("locale");
65 });
66});