Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ProviderModelsSection.test.ts

23 lines896 Bytes

1import { describe, expect, it } from "vite-plus/test";
2import type { ServerProviderModel } from "@t3tools/contracts";
3​
4import { groupModelsForDisplay } from "./ProviderModelsSection";
5​
6function model(slug: string, isCustom = false): ServerProviderModel {
7 return { slug, name: slug, isCustom, capabilities: null };
8}
9​
10describe("groupModelsForDisplay", () => {
11 it("lists favorites first, then visible models in user order, then hidden ones", () => {
12 const models = [model("a"), model("b"), model("c"), model("d"), model("custom", true)];
13​
14 const display = groupModelsForDisplay(models, {
15 favoriteModels: new Set(["c"]),
16 hiddenModels: new Set(["a", "custom"]),
17 modelOrder: ["d", "b"],
18 });
19​
20 // A custom model is never hidden, even if its slug is in the hidden set.
21 expect(display.map((entry) => entry.slug)).toEqual(["c", "d", "b", "custom", "a"]);
22 });
23});