1import { describe, expect, it } from "vite-plus/test";
2
3import { resolveThreadSyncPhase, threadSyncLabel } from "./threadSync";
4
5describe("resolveThreadSyncPhase", () => {
6 it("loads when only shell data is available", () => {
7 expect(
8 resolveThreadSyncPhase({
9 detailExists: false,
10 shellExists: true,
11 status: "synchronizing",
12 }),
13 ).toBe("loading");
14 });
15
16 it("syncs when cached detail is already visible", () => {
17 expect(
18 resolveThreadSyncPhase({
19 detailExists: true,
20 shellExists: true,
21 status: "cached",
22 }),
23 ).toBe("syncing");
24 });
25
26 it("does not report a sync phase without a shell or after going live", () => {
27 expect(
28 resolveThreadSyncPhase({
29 detailExists: false,
30 shellExists: false,
31 status: "empty",
32 }),
33 ).toBeNull();
34 expect(
35 resolveThreadSyncPhase({
36 detailExists: true,
37 shellExists: true,
38 status: "live",
39 }),
40 ).toBeNull();
41 });
42});
43
44describe("threadSyncLabel", () => {
45 it("uses the same loading and syncing language as mobile", () => {
46 expect(threadSyncLabel("loading")).toBe("Loading messages...");
47 expect(threadSyncLabel("syncing")).toBe("Syncing messages...");
48 });
49});