Skip to content
Source
Sign inSign up

chatThreadActions.test.ts

36 lines1.2 KB

1import { ProviderInstanceId, type ModelSelection } from "@t3tools/contracts";
2import { describe, expect, it } from "vite-plus/test";
3import { resolveNewThreadModelSelectionOverride } from "./chatThreadActions";
4​
5const PROJECT_DEFAULT_SELECTION: ModelSelection = {
6 instanceId: ProviderInstanceId.make("codex"),
7 model: "project-default",
8};
9const CARRIED_SELECTION: ModelSelection = {
10 instanceId: ProviderInstanceId.make("codex"),
11 model: "carried-model",
12};
13​
14describe("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});