Files
t3code/apps/web/src/components/settings/ProviderInstanceCard.test.ts
2026-06-03 16:16:53 -07:00

37 lines
992 B
TypeScript

import { describe, expect, it } from "vite-plus/test";
import type { ServerProviderModel } from "@t3tools/contracts";
import { deriveProviderModelsForDisplay } from "./ProviderInstanceCard";
describe("deriveProviderModelsForDisplay", () => {
it("uses current config custom models instead of stale live custom rows", () => {
const liveModels: ReadonlyArray<ServerProviderModel> = [
{
slug: "server-model",
name: "Server Model",
isCustom: false,
capabilities: null,
},
{
slug: "removed-custom",
name: "Removed Custom",
isCustom: true,
capabilities: null,
},
{
slug: "kept-custom",
name: "Kept Custom",
isCustom: true,
capabilities: null,
},
];
expect(
deriveProviderModelsForDisplay({
liveModels,
customModels: ["kept-custom"],
}).map((model) => model.slug),
).toEqual(["server-model", "kept-custom"]);
});
});