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

threadContentPresentation.test.ts

31 lines917 Bytes

1import { describe, expect, it } from "@effect/vitest";
2​
3import { projectThreadContentPresentation } from "./threadContentPresentation";
4​
5describe("thread content presentation", () => {
6 it("renders cached detail while its environment reconnects", () => {
7 expect(
8 projectThreadContentPresentation({
9 hasDetail: true,
10 detailError: null,
11 detailDeleted: false,
12 connectionState: "reconnecting",
13 }),
14 ).toEqual({ kind: "ready" });
15 });
16​
17 it("explains uncached detail while disconnected instead of loading forever", () => {
18 expect(
19 projectThreadContentPresentation({
20 hasDetail: false,
21 detailError: null,
22 detailDeleted: false,
23 connectionState: "error",
24 }),
25 ).toEqual({
26 kind: "unavailable",
27 title: "Messages not cached",
28 detail: "Reconnect this environment to load the conversation.",
29 });
30 });
31});