| ... | ... | @@ -1,10 +1,10 @@ |
| 1 | 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | | import type { ProviderOptionDescriptor } from "@t3tools/contracts"; |
| 2 | import { ProviderDriverKind, type ProviderOptionDescriptor } from "@t3tools/contracts"; |
| 3 | 3 | import { buildTraitsTriggerDisplay } from "./TraitsPicker"; |
| 4 | 4 | |
| 5 | 5 | function selectDescriptor( |
| 6 | 6 | id: string, |
| 7 | | options: ReadonlyArray<{ id: string; label: string }>, |
| 7 | options: ReadonlyArray<{ id: string; label: string; isDefault?: boolean }>, |
| 8 | 8 | currentValue: string, |
| 9 | 9 | ): Extract<ProviderOptionDescriptor, { type: "select" }> { |
| 10 | 10 | return { id, label: id, type: "select", options: [...options], currentValue }; |
| ... | ... | @@ -17,7 +17,7 @@ function fastModeDescriptor( |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | const EFFORT = selectDescriptor( |
| 20 | | "effort", |
| 20 | "reasoningEffort", |
| 21 | 21 | [ |
| 22 | 22 | { id: "high", label: "High" }, |
| 23 | 23 | { id: "max", label: "Max" }, |
| ... | ... | @@ -33,10 +33,13 @@ const CONTEXT_WINDOW = selectDescriptor( |
| 33 | 33 | "1m", |
| 34 | 34 | ); |
| 35 | 35 | |
| 36 | const CODEX = ProviderDriverKind.make("codex"); |
| 37 | |
| 36 | 38 | function display(descriptors: ReadonlyArray<ProviderOptionDescriptor>, fastModeEnabled: boolean) { |
| 37 | 39 | return buildTraitsTriggerDisplay({ |
| 40 | provider: CODEX, |
| 38 | 41 | descriptors, |
| 39 | | primarySelectDescriptorId: "effort", |
| 42 | primarySelectDescriptorId: "reasoningEffort", |
| 40 | 43 | ultrathinkPromptControlled: false, |
| 41 | 44 | fastModeEnabled, |
| 42 | 45 | }); |
| ... | ... | @@ -57,6 +60,16 @@ describe("buildTraitsTriggerDisplay", () => { |
| 57 | 60 | }); |
| 58 | 61 | }); |
| 59 | 62 | |
| 63 | it("omits Codex's default Standard tier beside reasoning", () => { |
| 64 | const serviceTier = selectDescriptor( |
| 65 | "serviceTier", |
| 66 | [{ id: "default", label: "Standard", isDefault: true }], |
| 67 | "default", |
| 68 | ); |
| 69 | |
| 70 | expect(display([EFFORT, serviceTier], false).label).toBe("High"); |
| 71 | }); |
| 72 | |
| 60 | 73 | it("keeps non-fastMode booleans as text labels", () => { |
| 61 | 74 | const thinking: Extract<ProviderOptionDescriptor, { type: "boolean" }> = { |
| 62 | 75 | id: "thinking", |
| ... | ... | @@ -100,8 +113,9 @@ describe("buildTraitsTriggerDisplay", () => { |
| 100 | 113 | it("still renders the prompt-controlled ultrathink label alongside the bolt", () => { |
| 101 | 114 | expect( |
| 102 | 115 | buildTraitsTriggerDisplay({ |
| 116 | provider: CODEX, |
| 103 | 117 | descriptors: [EFFORT, fastModeDescriptor(true)], |
| 104 | | primarySelectDescriptorId: "effort", |
| 118 | primarySelectDescriptorId: "reasoningEffort", |
| 105 | 119 | ultrathinkPromptControlled: true, |
| 106 | 120 | fastModeEnabled: true, |
| 107 | 121 | }), |