Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

ChatHeader.test.ts

48 lines1.4 KB

1import { EnvironmentId } from "@t3tools/contracts";
2import { describe, expect, it } from "vitest";
3​
4import { shouldShowOpenInPicker } from "./ChatHeader";
5​
6describe("shouldShowOpenInPicker", () => {
7 const primaryEnvironmentId = EnvironmentId.make("environment-primary");
8​
9 it("shows the picker for projects in the primary environment", () => {
10 expect(
11 shouldShowOpenInPicker({
12 activeProjectName: "codething-mvp",
13 activeThreadEnvironmentId: primaryEnvironmentId,
14 primaryEnvironmentId,
15 }),
16 ).toBe(true);
17 });
18​
19 it("hides the picker when hosted static mode has no primary environment", () => {
20 expect(
21 shouldShowOpenInPicker({
22 activeProjectName: "codething-mvp",
23 activeThreadEnvironmentId: EnvironmentId.make("environment-remote"),
24 primaryEnvironmentId: null,
25 }),
26 ).toBe(false);
27 });
28​
29 it("hides the picker for remote environments", () => {
30 expect(
31 shouldShowOpenInPicker({
32 activeProjectName: "codething-mvp",
33 activeThreadEnvironmentId: EnvironmentId.make("environment-remote"),
34 primaryEnvironmentId,
35 }),
36 ).toBe(false);
37 });
38​
39 it("hides the picker when there is no active project", () => {
40 expect(
41 shouldShowOpenInPicker({
42 activeProjectName: undefined,
43 activeThreadEnvironmentId: primaryEnvironmentId,
44 primaryEnvironmentId,
45 }),
46 ).toBe(false);
47 });
48});