Open History to see the last commit
1import { describe, expect, it } from "@effect/vitest";
2
3import {
4 projectThreadContentPresentation,
5 threadSyncStatusLabel,
6} from "./threadContentPresentation";
7
8describe("thread content presentation", () => {
9 it("renders cached detail while its environment reconnects", () => {
10 expect(
11 projectThreadContentPresentation({
12 hasDetail: true,
13 detailError: null,
14 detailDeleted: false,
15 connectionState: "reconnecting",
16 }),
17 ).toEqual({ kind: "ready" });
18 });
19
20 it("explains uncached detail while disconnected instead of loading forever", () => {
21 expect(
22 projectThreadContentPresentation({
23 hasDetail: false,
24 detailError: null,
25 detailDeleted: false,
26 connectionState: "error",
27 }),
28 ).toEqual({
29 kind: "unavailable",
30 title: "Messages not cached",
31 detail: "Reconnect this environment to load the conversation.",
32 });
33 });
34
35 it("shows a sync failure over cached messages instead of syncing forever", () => {
36 expect(threadSyncStatusLabel("cached", "ready", true)).toBe("Could not sync messages");
37 expect(threadSyncStatusLabel("cached", "ready", false)).toBe("Syncing messages…");
38 });
39});