Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2import type { ServerProviderModel } from "@t3tools/contracts";
3
4import { deriveProviderModelsForDisplay } from "./ProviderInstanceCard";
5
6describe("deriveProviderModelsForDisplay", () => {
7 it("uses current config custom models instead of stale live custom rows", () => {
8 const liveModels: ReadonlyArray<ServerProviderModel> = [
9 {
10 slug: "server-model",
11 name: "Server Model",
12 isCustom: false,
13 capabilities: null,
14 },
15 {
16 slug: "removed-custom",
17 name: "Removed Custom",
18 isCustom: true,
19 capabilities: null,
20 },
21 {
22 slug: "kept-custom",
23 name: "Kept Custom",
24 isCustom: true,
25 capabilities: null,
26 },
27 ];
28
29 expect(
30 deriveProviderModelsForDisplay({
31 liveModels,
32 customModels: ["kept-custom"],
33 }).map((model) => model.slug),
34 ).toEqual(["server-model", "kept-custom"]);
35 });
36});