| 1 | import type { ProviderOptionDescriptor } from "@t3tools/contracts"; |
| 2 | import { describe, expect, it } from "vite-plus/test"; |
| 3 | |
| 4 | import { runtimeModeChoicesForSupportedModes, selectableChoices } from "./thread-settings-options"; |
| 5 | |
| 6 | const effortDescriptor: Extract<ProviderOptionDescriptor, { type: "select" }> = { |
| 7 | id: "effort", |
| 8 | label: "Reasoning", |
| 9 | type: "select", |
| 10 | options: [ |
| 11 | { id: "low", label: "Low" }, |
| 12 | { id: "medium", label: "Medium", isDefault: true }, |
| 13 | { id: "high", label: "High" }, |
| 14 | { id: "ultrathink", label: "Ultrathink" }, |
| 15 | { id: "ultracode", label: "Ultracode" }, |
| 16 | ], |
| 17 | currentValue: "high", |
| 18 | promptInjectedValues: ["ultrathink"], |
| 19 | }; |
| 20 | |
| 21 | describe("selectableChoices", () => { |
| 22 | it("hides prompt-injected and workflow-trigger choices, keeping declared order", () => { |
| 23 | expect(selectableChoices(effortDescriptor).map((choice) => choice.id)).toEqual([ |
| 24 | "low", |
| 25 | "medium", |
| 26 | "high", |
| 27 | ]); |
| 28 | }); |
| 29 | }); |
| 30 | |
| 31 | describe("runtimeModeChoicesForSupportedModes", () => { |
| 32 | it("keeps controls usable when forward-compatible decoding removes every advertised mode", () => { |
| 33 | expect(runtimeModeChoicesForSupportedModes([])).toHaveLength(4); |
| 34 | }); |
| 35 | }); |