The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { ProviderInstanceId, type ModelSelection } from "@t3tools/contracts"; |
| 2 | import { describe, expect, it } from "vite-plus/test"; |
| 3 | import { resolveNewThreadModelSelectionOverride } from "./chatThreadActions"; |
| 4 | |
| 5 | const PROJECT_DEFAULT_SELECTION: ModelSelection = { |
| 6 | instanceId: ProviderInstanceId.make("codex"), |
| 7 | model: "project-default", |
| 8 | }; |
| 9 | const CARRIED_SELECTION: ModelSelection = { |
| 10 | instanceId: ProviderInstanceId.make("codex"), |
| 11 | model: "carried-model", |
| 12 | }; |
| 13 | |
| 14 | describe("chatThreadActions", () => { |
| 15 | it("does not carry a non-explicit model from the destination draft back into itself", () => { |
| 16 | expect( |
| 17 | resolveNewThreadModelSelectionOverride({ |
| 18 | projectDefaultSelection: null, |
| 19 | carrySelection: CARRIED_SELECTION, |
| 20 | carrySourceDraftId: "draft-a", |
| 21 | destinationDraftId: "draft-a", |
| 22 | }), |
| 23 | ).toBeNull(); |
| 24 | }); |
| 25 | |
| 26 | it("keeps the project default above any carried selection", () => { |
| 27 | expect( |
| 28 | resolveNewThreadModelSelectionOverride({ |
| 29 | projectDefaultSelection: PROJECT_DEFAULT_SELECTION, |
| 30 | carrySelection: CARRIED_SELECTION, |
| 31 | carrySourceDraftId: "draft-a", |
| 32 | destinationDraftId: "draft-b", |
| 33 | }), |
| 34 | ).toEqual(PROJECT_DEFAULT_SELECTION); |
| 35 | }); |
| 36 | }); |