Open History to see the last commit
1import { scopeThreadRef } from "@t3tools/client-runtime/environment";
2import { EnvironmentId, ThreadId } from "@t3tools/contracts";
3import { expect, it } from "vite-plus/test";
4
5import { selectActiveRightPanelSurface, useRightPanelStore } from "../rightPanelStore";
6import { resolveThreadOpenRoute } from "./sideChatPane";
7
8const environmentId = EnvironmentId.make("environment:test");
9const mainRef = scopeThreadRef(environmentId, ThreadId.make("main"));
10const sideChatRef = scopeThreadRef(environmentId, ThreadId.make("side-chat"));
11
12it("routes a side chat to its parent with the side chat tab active", () => {
13 useRightPanelStore.setState(useRightPanelStore.getInitialState());
14 const route = resolveThreadOpenRoute(sideChatRef, {
15 lineage: { sideChat: true, parentThreadId: mainRef.threadId } as never,
16 });
17
18 expect(route).toEqual(mainRef);
19 expect(
20 selectActiveRightPanelSurface(useRightPanelStore.getState().byThreadKey, mainRef)?.id,
21 ).toBe("side-chat:side-chat");
22 expect(
23 resolveThreadOpenRoute(mainRef, {
24 lineage: { sideChat: false, parentThreadId: null } as never,
25 }),
26 ).toBe(mainRef);
27});