@intentius/behold 0.30.1 → 0.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +31 -1
- package/README.md +11 -6
- package/dist/cli.js +1516 -840
- package/example-choudoufu-estate/chant.workspace.json +1 -1
- package/example-terraform-estate/README.md +1 -1
- package/example-terraform-estate/chant.workspace.json +1 -1
- package/example-terralith/README.md +1 -1
- package/example-three-cloud/package-lock.json +19 -19
- package/example-three-cloud/package.json +4 -4
- package/package.json +5 -5
- package/web/app.js +263 -16
- package/web/embed.js +2 -2
- package/web/event-help-modal.js +18 -12
- package/web/event-help-modal.test.js +28 -1
- package/web/index.html +18 -0
- package/web/kiosk-ask-layout.js +85 -0
- package/web/kiosk-ask-layout.test.js +83 -0
- package/web/kiosk-ask-tips.js +467 -0
- package/web/kiosk-ask-tips.test.js +359 -0
- package/web/kiosk-ask.js +774 -0
- package/web/kiosk-ask.test.js +593 -0
- package/web/kiosk-banner.js +108 -0
- package/web/kiosk-banner.test.js +72 -0
- package/web/kiosk-center-cards.test.js +110 -0
- package/web/kiosk-estate-scene.js +203 -0
- package/web/kiosk-estate-scene.test.js +21 -0
- package/web/kiosk-event-help.js +4 -1
- package/web/kiosk-graph-pane.js +63 -0
- package/web/kiosk-graph-pane.test.js +105 -0
- package/web/kiosk-light-frame.js +196 -0
- package/web/kiosk-light.js +509 -0
- package/web/kiosk-light.test.js +297 -0
- package/web/kiosk-metrics.js +7 -4
- package/web/kiosk-modal-sticky.test.js +2 -1
- package/web/kiosk-refit.test.js +81 -0
- package/web/kiosk-reset.js +49 -0
- package/web/kiosk-reset.test.js +11 -0
- package/web/kiosk-shot.js +40 -2
- package/web/kiosk-shot.test.js +23 -1
- package/web/kiosk-vendor.js +85 -7
- package/web/kiosk-vendor.test.js +9 -9
- package/web/kiosk-watch.js +8 -4
- package/web/kiosk.html +107 -1
- package/web/kiosk.js +149 -23
- package/web/kiosk.test.js +25 -1
- package/web/small-stage.test.js +4 -0
- package/web/terragucci-change.js +30 -13
- package/web/tool-mark.js +4 -4
- package/web/tool-mark.test.js +1 -1
- package/web/vendors/atmos.svg +1 -0
- package/web/vendors/chant.svg +1 -0
- package/web/vendors/choudoufu.svg +1 -0
- package/web/vendors/terragrunt.svg +9 -0
- package/web/vendors/terragucci.svg +1 -0
- package/web/vendors/choudoufu-128.png +0 -0
- package/web/vendors/choudoufu-64.png +0 -0
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { EMPH_MS, newestLine, DIFF_MS, diffLines, diffParts, BEAT_GAP_MS, BUSY_MIN_MS, CURSOR_PAUSE_MS, ELLIPSIS_MS, KEEP, REPLY_TYPE_MS, SPINNER, TYPE_MS, askBeats, busyLabel, ellipsisAt, mergeTurns, settleTurns, spinnerAt, askEventHelp, askMode, askShot, beatTiming, createAskPane, elapsedSecs, fillReply, firstSentence, hasAsk, paneHeight, playback, replyValues, statusText, typedChars } from "./kiosk-ask.js";
|
|
3
|
+
|
|
4
|
+
describe("fillReply (behold#936)", () => {
|
|
5
|
+
it("fills the report's tokens", () => {
|
|
6
|
+
const v = replyValues({ totals: { create: 2, update: 5 }, totals_roots: 3 });
|
|
7
|
+
expect(fillReply("All {roots} states. One plan: {creates} to create, {updates} to change, {deletes} to delete.", v)).toBe("All 3 states. One plan: 2 to create, 5 to change, 0 to delete.");
|
|
8
|
+
});
|
|
9
|
+
it("renders an unknown token, or one without a value, as empty", () => {
|
|
10
|
+
expect(fillReply("a {nope} b {error} c {dependents}.", replyValues(null))).toBe("a b c .");
|
|
11
|
+
expect(fillReply("{roots}/{creates}", replyValues({ totals: null }))).toBe("/");
|
|
12
|
+
});
|
|
13
|
+
it("takes the failed root's error and extra tokens (behold#937's dependents)", () => {
|
|
14
|
+
const v = replyValues({ totals: {}, totals_roots: 1 }, "range check", { dependents: 7 });
|
|
15
|
+
expect(fillReply("{error}: {dependents}", v)).toBe("range check: 7");
|
|
16
|
+
});
|
|
17
|
+
it("does not read inherited names", () => {
|
|
18
|
+
expect(fillReply("{constructor}{toString}", {})).toBe("");
|
|
19
|
+
});
|
|
20
|
+
it("returns empty for a missing template", () => {
|
|
21
|
+
expect(fillReply(null, {})).toBe("");
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe("typing (behold#936)", () => {
|
|
26
|
+
it("types one character per TYPE_MS", () => {
|
|
27
|
+
expect(typedChars(10, 0)).toBe(0);
|
|
28
|
+
expect(typedChars(10, TYPE_MS * 3 + 1)).toBe(3);
|
|
29
|
+
expect(typedChars(10, 100000)).toBe(10);
|
|
30
|
+
expect(typedChars(10, -5)).toBe(0);
|
|
31
|
+
});
|
|
32
|
+
it("shows everything at once with reduced motion", () => {
|
|
33
|
+
expect(typedChars(10, 0, { reduced: true })).toBe(10);
|
|
34
|
+
});
|
|
35
|
+
it("types a prompt at about 90 ms a character after a 600 ms cursor, and a reply at about 35", () => {
|
|
36
|
+
expect(TYPE_MS).toBe(90);
|
|
37
|
+
expect(CURSOR_PAUSE_MS).toBe(600);
|
|
38
|
+
expect(REPLY_TYPE_MS).toBe(35);
|
|
39
|
+
expect(BUSY_MIN_MS).toBe(1200);
|
|
40
|
+
expect(ELLIPSIS_MS).toBe(400);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe("playback: the turn states (ready, typing, busy, replied)", () => {
|
|
45
|
+
const prompt = { prompt: "abcd", reply: "okay" };
|
|
46
|
+
const action = { action: "approve", reply: null };
|
|
47
|
+
it("is ready on the cursor's pause, then typing, then busy for at least 1.2 s, then replied", () => {
|
|
48
|
+
const t = beatTiming(prompt);
|
|
49
|
+
expect(t.cursor).toBe(CURSOR_PAUSE_MS);
|
|
50
|
+
expect(t.busyAt).toBe(CURSOR_PAUSE_MS + 4 * TYPE_MS);
|
|
51
|
+
expect(t.replyAt - t.busyAt).toBe(BUSY_MIN_MS);
|
|
52
|
+
expect(t.end).toBe(t.replyAt + 4 * REPLY_TYPE_MS);
|
|
53
|
+
let f = playback([prompt], CURSOR_PAUSE_MS - 1).frames[0];
|
|
54
|
+
expect(f).toMatchObject({ mark: ">", text: "", typing: true, ready: true, busy: false, replied: false });
|
|
55
|
+
f = playback([prompt], CURSOR_PAUSE_MS + 2 * TYPE_MS).frames[0];
|
|
56
|
+
expect(f).toMatchObject({ text: "ab", typing: true, ready: false, busy: false });
|
|
57
|
+
f = playback([prompt], t.busyAt).frames[0];
|
|
58
|
+
expect(f).toMatchObject({ text: "abcd", typing: false, busy: true, replied: false, sumSecs: null });
|
|
59
|
+
f = playback([prompt], t.replyAt - 1).frames[0];
|
|
60
|
+
expect(f).toMatchObject({ busy: true, replied: false });
|
|
61
|
+
f = playback([prompt], t.replyAt + 2 * REPLY_TYPE_MS).frames[0];
|
|
62
|
+
expect(f).toMatchObject({ busy: false, sumSecs: 1, replied: true, replyChars: 2, replyTyping: true, over: false });
|
|
63
|
+
const p = playback([prompt], t.end);
|
|
64
|
+
expect(p.frames[0]).toMatchObject({ replyChars: 4, replyTyping: false, over: true });
|
|
65
|
+
expect(p.done).toBe(true);
|
|
66
|
+
});
|
|
67
|
+
it("times a reply by its filled text when it is known", () => {
|
|
68
|
+
expect(beatTiming(prompt, { reply: "a much longer reply" }).end).toBe(beatTiming(prompt).replyAt + 19 * REPLY_TYPE_MS);
|
|
69
|
+
});
|
|
70
|
+
it("shows an action line at once with a check mark, busy while its reply is pending", () => {
|
|
71
|
+
const p = playback([action], 0);
|
|
72
|
+
expect(p.frames[0]).toMatchObject({ mark: "✓", text: "approve", typing: false, ready: false, busy: true, over: true });
|
|
73
|
+
expect(p.done).toBe(true);
|
|
74
|
+
expect(playback([{ action: "go", reply: "ok" }], 100).frames[0]).toMatchObject({ busy: true, replied: false });
|
|
75
|
+
});
|
|
76
|
+
it("plays beats in order with a gap, and the earlier busy line ends when the next beat begins", () => {
|
|
77
|
+
const first = beatTiming(prompt).end;
|
|
78
|
+
let p = playback([prompt, action], first);
|
|
79
|
+
expect(p.frames).toHaveLength(1);
|
|
80
|
+
expect(p.gap).toBe(true);
|
|
81
|
+
p = playback([prompt, action], first + BEAT_GAP_MS);
|
|
82
|
+
expect(p.frames).toHaveLength(2);
|
|
83
|
+
expect(p.gap).toBe(false);
|
|
84
|
+
const open = playback([action, prompt], BEAT_GAP_MS + 10);
|
|
85
|
+
expect(open.frames[0]).toMatchObject({ busy: false, sumSecs: 2 });
|
|
86
|
+
});
|
|
87
|
+
it("prints everything at once with reduced motion, with no busy phase", () => {
|
|
88
|
+
const p = playback([prompt], 0, { reduced: true });
|
|
89
|
+
expect(p.frames[0]).toMatchObject({ text: "abcd", ready: false, busy: false, replied: true, replyChars: 4, over: true });
|
|
90
|
+
expect(p.done).toBe(true);
|
|
91
|
+
});
|
|
92
|
+
it("plays a note (opening, closing) at once and unmarked, never busy", () => {
|
|
93
|
+
expect(playback([{ note: "Three states." }], 0).frames[0]).toMatchObject({ mark: "", text: "Three states.", typing: false, busy: false, over: true });
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
describe("the busy line's pieces", () => {
|
|
98
|
+
it("cycles the spinner glyph and steps the ellipsis every 400 ms", () => {
|
|
99
|
+
expect(SPINNER).toEqual(["✻", "✶", "✳", "✢", "·"]);
|
|
100
|
+
expect(new Set(SPINNER.map((_, i) => spinnerAt(i * 140))).size).toBe(5);
|
|
101
|
+
expect([0, 400, 800, 1200].map((t) => ellipsisAt(t))).toEqual([".", "..", "...", "."]);
|
|
102
|
+
});
|
|
103
|
+
it("is still under reduced motion", () => {
|
|
104
|
+
expect([0, 140, 5000].map((t) => spinnerAt(t, true))).toEqual(["✻", "✻", "✻"]);
|
|
105
|
+
expect([0, 400, 800].map((t) => ellipsisAt(t, true))).toEqual(["…", "…", "…"]);
|
|
106
|
+
});
|
|
107
|
+
it("drops a closing full stop or ellipsis from the label", () => {
|
|
108
|
+
expect(busyLabel("Applying across estates.")).toBe("Applying across estates");
|
|
109
|
+
expect(busyLabel("Planning…")).toBe("Planning");
|
|
110
|
+
expect(busyLabel("")).toBe("Working");
|
|
111
|
+
});
|
|
112
|
+
it("lets a lone reply or a status continue the last turn, and settles busy lines into summaries", () => {
|
|
113
|
+
const t = mergeTurns([{ mark: ">", text: "a", parts: [] }], [{ cont: true, parts: [{ k: "reply", text: "r" }] }, { mark: ">", text: "b", parts: [] }]);
|
|
114
|
+
expect(t.map((x) => x.text)).toEqual(["a", "b"]);
|
|
115
|
+
expect(t[0].parts).toHaveLength(1);
|
|
116
|
+
const s = settleTurns([{ mark: ">", text: "a", ready: true, typing: true, parts: [{ k: "busy", label: "Applying", since: 1000 }] }], 36000);
|
|
117
|
+
expect(s[0]).toMatchObject({ ready: false, typing: false, parts: [{ k: "sum", label: "Applying", secs: 35 }] });
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe("askBeats and statusLine (behold#936)", () => {
|
|
122
|
+
it("prefers asks, then ask, else none", () => {
|
|
123
|
+
expect(askBeats(null)).toEqual([]);
|
|
124
|
+
expect(askBeats({ ask: null, asks: null })).toEqual([]);
|
|
125
|
+
expect(askBeats({ ask: { prompt: "a" } })).toHaveLength(1);
|
|
126
|
+
expect(askBeats({ ask: { prompt: "a" }, asks: [{ prompt: "b" }, { action: "c" }] })).toHaveLength(2);
|
|
127
|
+
});
|
|
128
|
+
it("keeps a reply with no prompt or action, and gives it no line of its own", () => {
|
|
129
|
+
expect(askBeats({ ask: { prompt: null, action: null, reply: "Applied." } })).toHaveLength(1);
|
|
130
|
+
expect(askBeats({ ask: { prompt: null, action: null, reply: null } })).toEqual([]);
|
|
131
|
+
expect(playback([{ reply: "Applied." }], 600 + 9 * REPLY_TYPE_MS).frames[0]).toMatchObject({ mark: "", text: "", replied: true, over: true });
|
|
132
|
+
});
|
|
133
|
+
it("keeps a status alone as a beat", () => {
|
|
134
|
+
expect(askBeats({ ask: { status: "Applying." } })).toHaveLength(1);
|
|
135
|
+
expect(hasAsk({ ask: { status: "Applying." } })).toBe(true);
|
|
136
|
+
});
|
|
137
|
+
it("takes the status from the ask, else the label's first sentence, else none", () => {
|
|
138
|
+
expect(statusText({ ask: { status: "Applying wave 1." }, label: "x" })).toBe("Applying wave 1.");
|
|
139
|
+
expect(statusText({ asks: [{ prompt: "p", status: "Waiting" }], label: "x" })).toBe("Waiting");
|
|
140
|
+
expect(statusText({ label: "The plan is merged. Applying next." })).toBe("The plan is merged");
|
|
141
|
+
expect(statusText({ label: "Applying" })).toBe("Applying");
|
|
142
|
+
expect(statusText({ ask: { prompt: "p" }, label: "Planned." })).toBeNull();
|
|
143
|
+
expect(statusText({ closing: "Done.", label: "Applied." })).toBeNull();
|
|
144
|
+
expect(statusText(null)).toBeNull();
|
|
145
|
+
});
|
|
146
|
+
it("cuts a label at its first sentence", () => {
|
|
147
|
+
expect(firstSentence("Three estates. One apply.")).toBe("Three estates");
|
|
148
|
+
expect(firstSentence("v1.2 is out")).toBe("v1.2 is out");
|
|
149
|
+
expect(firstSentence(null)).toBe("");
|
|
150
|
+
});
|
|
151
|
+
it("counts seconds from the step's start, never below zero", () => {
|
|
152
|
+
const t = Date.parse("2026-10-24T10:01:05Z");
|
|
153
|
+
expect(elapsedSecs({ started_at: "2026-10-24T10:00:00Z" }, t, 0)).toBe(65);
|
|
154
|
+
expect(elapsedSecs({ started_at: "2026-10-24T10:02:00Z" }, t, 0)).toBe(0);
|
|
155
|
+
expect(elapsedSecs({}, t, t - 7000)).toBe(7);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
describe("createAskPane: a session of turns", () => {
|
|
160
|
+
function fakeDoc() {
|
|
161
|
+
const make = (tag) => {
|
|
162
|
+
const n = { tag, className: "", textContent: "", children: [], hidden: false, attrs: {}, classes: [], offsetWidth: 0, ownerDocument: null, style: {} };
|
|
163
|
+
n.classList = { add: (c) => n.classes.push(c), remove: (c) => (n.classes = n.classes.filter((x) => x !== c)), toggle: (c, on) => (on ? (n.classes.includes(c) ? 0 : n.classes.push(c)) : (n.classes = n.classes.filter((x) => x !== c))) };
|
|
164
|
+
n.setAttribute = (k, v) => (n.attrs[k] = v);
|
|
165
|
+
n.append = (...c) => n.children.push(...c);
|
|
166
|
+
n.appendChild = (c) => n.children.push(c);
|
|
167
|
+
n.replaceChildren = (...c) => (n.children = c);
|
|
168
|
+
return n;
|
|
169
|
+
};
|
|
170
|
+
const doc = { createElement: make };
|
|
171
|
+
const host = make("section");
|
|
172
|
+
host.ownerDocument = doc;
|
|
173
|
+
return host;
|
|
174
|
+
}
|
|
175
|
+
const flat = (n) => [n.textContent, ...n.children.map(flat)].join("|");
|
|
176
|
+
const T0 = Date.parse("2026-10-24T10:00:00Z");
|
|
177
|
+
const demo = (step, extra = {}) => ({ cycle: 1, scenario: "compose-edit", step, started_at: "2026-10-24T10:00:00Z", next: null, ...extra });
|
|
178
|
+
const names = (events) => events.map((e) => e[0]).filter((n) => n !== "behold:ask-busy" && n !== "behold:ask-line" && n !== "behold:ask-light");
|
|
179
|
+
function make(clock, reduced = false) {
|
|
180
|
+
const events = [];
|
|
181
|
+
const win = { dispatchEvent: (e) => events.push([e.type, e.detail]) };
|
|
182
|
+
const host = fakeDoc();
|
|
183
|
+
let timer = null;
|
|
184
|
+
const pane = createAskPane({ host, win, now: () => new Date(clock.t), fill: () => ({ roots: 3 }), reduced: () => reduced, setTimer: (f) => ((timer = f), 1), clearTimer: () => (timer = null) });
|
|
185
|
+
return { pane, host, events, tick: () => timer && timer() };
|
|
186
|
+
}
|
|
187
|
+
const entries = (host) => host.children.map((c) => c.className).filter((c) => !c.includes("ask-ready-line"));
|
|
188
|
+
|
|
189
|
+
it("goes ready, typing, busy, replied; ask-done only after the reply has typed", () => {
|
|
190
|
+
const clock = { t: T0 };
|
|
191
|
+
const { pane, host, events, tick } = make(clock);
|
|
192
|
+
const ask = { prompt: "go", status: "Planning network, app and edge", reply: "All {roots} states." };
|
|
193
|
+
expect(pane.setStep(demo("planned", { ask }))).toBe(true);
|
|
194
|
+
// 1. ready: the edge is lit, an empty prompt line waits with its cursor.
|
|
195
|
+
expect(names(events)).toEqual(["behold:ask-hold", "behold:ask-start"]);
|
|
196
|
+
expect(host.classes).toContain("ask-ready");
|
|
197
|
+
expect(flat(host)).toContain(">|");
|
|
198
|
+
expect(host.children[0].classes).toContain("ask-waiting");
|
|
199
|
+
// 2. typing: the light dims.
|
|
200
|
+
clock.t += CURSOR_PAUSE_MS + TYPE_MS + 1;
|
|
201
|
+
tick();
|
|
202
|
+
expect(host.classes).not.toContain("ask-ready");
|
|
203
|
+
expect(flat(host)).toContain("g");
|
|
204
|
+
expect(host.children[0].classes).toContain("ask-typing");
|
|
205
|
+
// 3. busy: the label, for at least 1.2 s, and no reply yet.
|
|
206
|
+
clock.t += TYPE_MS + 50;
|
|
207
|
+
tick();
|
|
208
|
+
let text = flat(host);
|
|
209
|
+
expect(text).toContain("Planning network, app and edge");
|
|
210
|
+
expect(text).not.toContain("All");
|
|
211
|
+
expect(host.children[0].children.some((c) => c.className === "ask-busy")).toBe(true);
|
|
212
|
+
clock.t += BUSY_MIN_MS - 200;
|
|
213
|
+
tick();
|
|
214
|
+
expect(flat(host)).not.toContain("All");
|
|
215
|
+
// 4. replied: the busy line is a dim summary, the reply types, and the graph waits.
|
|
216
|
+
clock.t += 200 + 3 * REPLY_TYPE_MS;
|
|
217
|
+
tick();
|
|
218
|
+
text = flat(host);
|
|
219
|
+
expect(text).toMatch(/✓ Planning network, app and edge \(0:01\)/);
|
|
220
|
+
expect(text).toContain("All");
|
|
221
|
+
expect(text).not.toContain("All 3 states.");
|
|
222
|
+
expect(names(events)).not.toContain("behold:ask-done");
|
|
223
|
+
clock.t += 30 * REPLY_TYPE_MS;
|
|
224
|
+
tick();
|
|
225
|
+
expect(names(events)).toEqual(["behold:ask-hold", "behold:ask-start", "behold:ask-done"]);
|
|
226
|
+
expect(flat(host)).toContain("All 3 states.");
|
|
227
|
+
expect(events[1][1]).toEqual({ ask, step: "planned", scenario: "compose-edit" });
|
|
228
|
+
});
|
|
229
|
+
it("tells the tip cards when a busy line shows and when it ends (ask-busy)", () => {
|
|
230
|
+
const clock = { t: T0 };
|
|
231
|
+
const { pane, events, tick } = make(clock);
|
|
232
|
+
const tips = [{ title: "t", body: "b" }];
|
|
233
|
+
const busy = () => events.filter((e) => e[0] === "behold:ask-busy").map((e) => [e[1].busy, e[1].tips]);
|
|
234
|
+
// A status-only step: busy at once, with the status's tips.
|
|
235
|
+
pane.setStep(demo("applying", { ask: { status: "Applying", tips } }));
|
|
236
|
+
expect(busy()).toEqual([[true, tips]]);
|
|
237
|
+
clock.t += BUSY_MIN_MS + 10;
|
|
238
|
+
tick();
|
|
239
|
+
// The next step is a turn: the status line ends, and no busy shows while the prompt types.
|
|
240
|
+
pane.setStep(demo("planned", { ask: { prompt: "go", status: "Planning", reply: "ok", tips: [{ title: "x", body: "y" }] } }));
|
|
241
|
+
expect(busy()).toEqual([[true, tips], [false, null]]);
|
|
242
|
+
// The turn's wait, then its reply: the busy event follows the busy line only.
|
|
243
|
+
clock.t += CURSOR_PAUSE_MS + 2 * TYPE_MS + 100;
|
|
244
|
+
tick();
|
|
245
|
+
expect(busy().slice(2)).toEqual([[true, [{ title: "x", body: "y" }]]]);
|
|
246
|
+
clock.t += BUSY_MIN_MS + 10;
|
|
247
|
+
tick();
|
|
248
|
+
expect(busy().slice(3)).toEqual([[false, null]]);
|
|
249
|
+
});
|
|
250
|
+
it("lights the edge again between beats and once a reply is done, while another prompt can follow", () => {
|
|
251
|
+
const clock = { t: T0 };
|
|
252
|
+
const { pane, host, tick } = make(clock);
|
|
253
|
+
pane.setStep(demo("planned", { asks: [{ prompt: "a", reply: "r" }, { prompt: "b", reply: "s" }] }));
|
|
254
|
+
clock.t += beatTiming({ prompt: "a", reply: "r" }).end + 10;
|
|
255
|
+
tick();
|
|
256
|
+
expect(host.classes).toContain("ask-ready");
|
|
257
|
+
expect(host.children.at(-1).className).toContain("ask-ready-line");
|
|
258
|
+
clock.t += BEAT_GAP_MS;
|
|
259
|
+
tick();
|
|
260
|
+
expect(host.children.at(-1).className).not.toContain("ask-ready-line");
|
|
261
|
+
});
|
|
262
|
+
it("shows a status-only step as a busy line under the turn, with a timer that counts", () => {
|
|
263
|
+
const clock = { t: T0 };
|
|
264
|
+
const { pane, host, tick } = make(clock);
|
|
265
|
+
pane.setStep(demo("planned", { ask: { action: "approve" } }));
|
|
266
|
+
expect(pane.setStep(demo("applying", { ask: { status: "Applying across estates." } }))).toBe(true);
|
|
267
|
+
// The step before has nothing left to play (an action is at once), so this one begins; its busy line sits under the action.
|
|
268
|
+
expect(flat(host)).toContain("approve");
|
|
269
|
+
expect(flat(host)).toContain("Applying across estates");
|
|
270
|
+
expect(host.classes).not.toContain("ask-ready");
|
|
271
|
+
const turn = host.children[0];
|
|
272
|
+
expect(turn.children.map((c) => c.className)).toEqual(["ask-line", "ask-sum", "ask-busy"]);
|
|
273
|
+
clock.t += 65000;
|
|
274
|
+
tick();
|
|
275
|
+
expect(flat(host)).toContain("(1:05)");
|
|
276
|
+
});
|
|
277
|
+
it("holds the graph at every step, and lights a status-only step as its busy line shows", () => {
|
|
278
|
+
const clock = { t: T0 };
|
|
279
|
+
const { pane, events, tick } = make(clock);
|
|
280
|
+
pane.setStep(demo("planned", { ask: { action: "approve" } }));
|
|
281
|
+
pane.setStep(demo("merged", { label: "The plan is merged. Applying next." }));
|
|
282
|
+
expect(events.filter((e) => e[0] === "behold:ask-hold")).toHaveLength(2);
|
|
283
|
+
// The busy line is on screen in the same draw: the graph lights with it, not 1.2 s later.
|
|
284
|
+
expect(events.filter((e) => e[0] === "behold:ask-status")).toEqual([["behold:ask-status", { status: "The plan is merged", step: "merged", scenario: "compose-edit" }]]);
|
|
285
|
+
const at = names(events).indexOf("behold:ask-status");
|
|
286
|
+
expect(events.findIndex((e) => e[0] === "behold:ask-busy" && e[1].busy)).toBeLessThan(events.findIndex((e) => e[0] === "behold:ask-status"));
|
|
287
|
+
expect(at).toBeGreaterThan(0);
|
|
288
|
+
clock.t += 5000;
|
|
289
|
+
tick();
|
|
290
|
+
expect(events.filter((e) => e[0] === "behold:ask-status")).toHaveLength(1);
|
|
291
|
+
});
|
|
292
|
+
it("still lets a status-only step's busy line show 1.2 s before the next step plays", () => {
|
|
293
|
+
const clock = { t: T0 };
|
|
294
|
+
const { pane, host, tick } = make(clock);
|
|
295
|
+
pane.setStep(demo("planned", { ask: { action: "approve" } }));
|
|
296
|
+
pane.setStep(demo("merged", { label: "Merged." }));
|
|
297
|
+
pane.setStep(demo("applying", { label: "Applying." }));
|
|
298
|
+
expect(flat(host)).toContain("Merged");
|
|
299
|
+
expect(flat(host)).not.toContain("Applying");
|
|
300
|
+
clock.t += BUSY_MIN_MS;
|
|
301
|
+
tick();
|
|
302
|
+
expect(flat(host)).toContain("Applying");
|
|
303
|
+
});
|
|
304
|
+
it("lets a step with no ask at all clear the graph only after its busy line has shown", () => {
|
|
305
|
+
const clock = { t: T0 };
|
|
306
|
+
const { pane, events, tick } = make(clock);
|
|
307
|
+
pane.setStep(demo("pull-request", { opening: "Three states." }));
|
|
308
|
+
expect(names(events)).toEqual(["behold:ask-hold"]);
|
|
309
|
+
clock.t += BUSY_MIN_MS;
|
|
310
|
+
tick();
|
|
311
|
+
expect(names(events)).toEqual(["behold:ask-hold", "behold:ask-clear"]);
|
|
312
|
+
});
|
|
313
|
+
it("lights the graph as the reply starts to print, in the same draw, and still says when it is done", () => {
|
|
314
|
+
const clock = { t: T0 };
|
|
315
|
+
const { pane, host, events, tick } = make(clock);
|
|
316
|
+
const ask = { prompt: "go", status: "Planning", reply: "All {roots} states.", light: ["network/x"] };
|
|
317
|
+
pane.setStep(demo("planned", { ask }));
|
|
318
|
+
const t = beatTiming(ask, { reply: "All 3 states." });
|
|
319
|
+
clock.t = T0 + t.replyAt - 1;
|
|
320
|
+
tick();
|
|
321
|
+
expect(events.map((e) => e[0])).not.toContain("behold:ask-light");
|
|
322
|
+
clock.t = T0 + t.replyAt;
|
|
323
|
+
tick();
|
|
324
|
+
// The reply line is on screen and the light is asked for in the same tick: no lag past the 40 ms draw.
|
|
325
|
+
expect(host.children[0].children.some((c) => (c.className || "").startsWith("ask-reply"))).toBe(true);
|
|
326
|
+
expect(events.filter((e) => e[0] === "behold:ask-light")).toEqual([["behold:ask-light", { ask, step: "planned", scenario: "compose-edit" }]]);
|
|
327
|
+
expect(events.map((e) => e[0])).not.toContain("behold:ask-done");
|
|
328
|
+
clock.t = T0 + t.end;
|
|
329
|
+
tick();
|
|
330
|
+
const order = events.map((e) => e[0]).filter((n) => n === "behold:ask-light" || n === "behold:ask-done");
|
|
331
|
+
expect(order).toEqual(["behold:ask-light", "behold:ask-done"]);
|
|
332
|
+
});
|
|
333
|
+
it("lights a beat with no reply once its line is done", () => {
|
|
334
|
+
const clock = { t: T0 };
|
|
335
|
+
const { pane, events } = make(clock);
|
|
336
|
+
pane.setStep(demo("planned", { ask: { action: "approve", light: ["a/b"] } }));
|
|
337
|
+
expect(events.map((e) => e[0]).filter((n) => n === "behold:ask-light" || n === "behold:ask-done")).toEqual(["behold:ask-light", "behold:ask-done"]);
|
|
338
|
+
});
|
|
339
|
+
it("says when each new line starts (ask-line): prompt, busy, reply, ready", () => {
|
|
340
|
+
const clock = { t: T0 };
|
|
341
|
+
const { pane, events, tick } = make(clock);
|
|
342
|
+
const ask = { prompt: "go", status: "Planning", reply: "ok" };
|
|
343
|
+
pane.setStep(demo("planned", { ask }));
|
|
344
|
+
const t = beatTiming(ask, { reply: "ok" });
|
|
345
|
+
for (const at of [t.cursor + 1, t.busyAt + 1, t.replyAt + 1, t.end + 1, t.end + 2]) {
|
|
346
|
+
clock.t = T0 + at;
|
|
347
|
+
tick();
|
|
348
|
+
}
|
|
349
|
+
expect(events.filter((e) => e[0] === "behold:ask-line").map((e) => e[1].kind)).toEqual(["prompt", "busy", "reply", "ready"]);
|
|
350
|
+
});
|
|
351
|
+
it("underlines the newest line while it is new, dims the lines before it in its turn, and lets go after EMPH_MS", () => {
|
|
352
|
+
const clock = { t: T0 };
|
|
353
|
+
const { pane, host, tick } = make(clock);
|
|
354
|
+
const ask = { prompt: "go", status: "Planning", reply: "a long enough reply to type for a while" };
|
|
355
|
+
pane.setStep(demo("planned", { ask }));
|
|
356
|
+
const t = beatTiming(ask, { reply: ask.reply });
|
|
357
|
+
clock.t = T0 + t.replyAt;
|
|
358
|
+
tick();
|
|
359
|
+
clock.t = T0 + t.replyAt + 100;
|
|
360
|
+
tick();
|
|
361
|
+
const kids = () => host.children[0].children;
|
|
362
|
+
const reply = kids().find((c) => (c.className || "").startsWith("ask-reply"));
|
|
363
|
+
expect(reply.classes).toContain("ask-new");
|
|
364
|
+
// The sweep picks up where it was when the line is drawn again (a reply redraws on every character).
|
|
365
|
+
expect(reply.style.animationDelay).toBe("-100ms");
|
|
366
|
+
expect(kids()[0].classes).toContain("ask-before");
|
|
367
|
+
clock.t = T0 + t.replyAt + EMPH_MS + 10;
|
|
368
|
+
tick();
|
|
369
|
+
const later = kids().find((c) => (c.className || "").startsWith("ask-reply"));
|
|
370
|
+
expect(later.classes).not.toContain("ask-new");
|
|
371
|
+
});
|
|
372
|
+
it("tells the tips when a busy line is due to end: the reply, else the driver's next step", () => {
|
|
373
|
+
const clock = { t: T0 };
|
|
374
|
+
const { pane, events, tick } = make(clock);
|
|
375
|
+
const ask = { prompt: "go", status: "Planning", reply: "ok" };
|
|
376
|
+
pane.setStep(demo("planned", { ask }));
|
|
377
|
+
const t = beatTiming(ask, { reply: "ok" });
|
|
378
|
+
clock.t = T0 + t.busyAt + 1;
|
|
379
|
+
tick();
|
|
380
|
+
const until = () => events.filter((e) => e[0] === "behold:ask-busy" && e[1].busy).map((e) => e[1].until);
|
|
381
|
+
expect(until()).toEqual([T0 + t.replyAt]);
|
|
382
|
+
clock.t = T0 + t.end + BUSY_MIN_MS;
|
|
383
|
+
tick();
|
|
384
|
+
pane.setStep(demo("applying", { ask: { status: "Applying" }, next: { at: "2026-10-24T10:01:00Z" } }));
|
|
385
|
+
expect(until().at(-1)).toBe(Date.parse("2026-10-24T10:01:00Z"));
|
|
386
|
+
});
|
|
387
|
+
it("makes a step that arrives while another plays wait for it, then plays it in order", () => {
|
|
388
|
+
const clock = { t: T0 };
|
|
389
|
+
const { pane, host, events, tick } = make(clock);
|
|
390
|
+
pane.setStep(demo("planned", { ask: { prompt: "go", reply: "Done." } }));
|
|
391
|
+
pane.setStep(demo("merged", { label: "Merged." }));
|
|
392
|
+
expect(flat(host)).not.toContain("Merged");
|
|
393
|
+
expect(events.filter((e) => e[0] === "behold:ask-hold")).toHaveLength(1);
|
|
394
|
+
clock.t += beatTiming({ prompt: "go", reply: "Done." }).end + 10;
|
|
395
|
+
tick();
|
|
396
|
+
expect(names(events)).toContain("behold:ask-done");
|
|
397
|
+
expect(flat(host)).toContain("Merged");
|
|
398
|
+
expect(flat(host)).toContain("Done.");
|
|
399
|
+
expect(events.filter((e) => e[0] === "behold:ask-hold")).toHaveLength(2);
|
|
400
|
+
});
|
|
401
|
+
it("keeps the transcript, dims older turns and leaves the newest bright", () => {
|
|
402
|
+
const clock = { t: T0 };
|
|
403
|
+
const { pane, host, tick } = make(clock);
|
|
404
|
+
for (const [i, w] of ["one", "two", "three", "four", "five"].entries()) {
|
|
405
|
+
pane.setStep(demo(`s${i}`, { ask: { prompt: w, reply: "r" } }));
|
|
406
|
+
clock.t += 20000;
|
|
407
|
+
tick();
|
|
408
|
+
}
|
|
409
|
+
const text = flat(host);
|
|
410
|
+
for (const w of ["one", "two", "three", "four", "five"]) expect(text).toContain(w);
|
|
411
|
+
expect(entries(host).at(-1)).toContain("ask-cur");
|
|
412
|
+
expect(entries(host).at(-2)).toContain("ask-old-1");
|
|
413
|
+
expect(entries(host).at(-4)).toContain("ask-old-3");
|
|
414
|
+
expect(entries(host)[0]).toContain("ask-old-3");
|
|
415
|
+
expect(KEEP).toBe(3);
|
|
416
|
+
});
|
|
417
|
+
it("continues a turn with a lone reply after a status step, the busy line collapsed into a summary", () => {
|
|
418
|
+
const clock = { t: T0 };
|
|
419
|
+
const { pane, host, tick } = make(clock);
|
|
420
|
+
pane.setStep(demo("planned", { ask: { prompt: "go" } }));
|
|
421
|
+
clock.t += 10000;
|
|
422
|
+
tick();
|
|
423
|
+
pane.setStep(demo("applying", { ask: { status: "Applying." } }));
|
|
424
|
+
clock.t += 10000;
|
|
425
|
+
tick();
|
|
426
|
+
pane.setStep(demo("applied", { ask: { reply: "All applied." } }));
|
|
427
|
+
clock.t += 5000;
|
|
428
|
+
tick();
|
|
429
|
+
const kinds = host.children[0].children.map((c) => c.className.split(" ")[0]);
|
|
430
|
+
expect(kinds).toEqual(["ask-line", "ask-sum", "ask-sum", "ask-reply"]);
|
|
431
|
+
expect(flat(host)).toMatch(/✓ Applying \(0:\d\d\)/);
|
|
432
|
+
});
|
|
433
|
+
it("shows static text under reduced motion: no busy phase, the reply at once", () => {
|
|
434
|
+
const clock = { t: T0 };
|
|
435
|
+
const { pane, host } = make(clock, true);
|
|
436
|
+
pane.setStep(demo("planned", { ask: { prompt: "go", status: "Planning", reply: "Done." } }));
|
|
437
|
+
expect(flat(host)).toContain("Done.");
|
|
438
|
+
expect(flat(host)).toContain("go");
|
|
439
|
+
pane.setStep(demo("applying", { ask: { status: "Applying." } }));
|
|
440
|
+
expect(host.children[0].children.some((c) => c.className === "ask-busy")).toBe(true);
|
|
441
|
+
expect(flat(host)).toContain("…");
|
|
442
|
+
});
|
|
443
|
+
it("hides at a reset, and when the scenario changes to one without an ask", () => {
|
|
444
|
+
const clock = { t: T0 };
|
|
445
|
+
const { pane, host } = make(clock);
|
|
446
|
+
pane.setStep(demo("planned", { ask: { action: "approve" } }));
|
|
447
|
+
expect(pane.setStep(null)).toBe(false);
|
|
448
|
+
expect(host.hidden).toBe(true);
|
|
449
|
+
pane.setStep(demo("planned", { ask: { action: "approve" } }));
|
|
450
|
+
expect(pane.setStep(demo("merged", { scenario: "other", label: "x" }))).toBe(false);
|
|
451
|
+
expect(host.hidden).toBe(true);
|
|
452
|
+
});
|
|
453
|
+
it("shows a pane that was never given an ask on a plain scenario only after one", () => {
|
|
454
|
+
const clock = { t: T0 };
|
|
455
|
+
const { pane } = make(clock);
|
|
456
|
+
expect(pane.setStep(demo("merged", { label: "x" }))).toBe(false);
|
|
457
|
+
});
|
|
458
|
+
it("does not restart on the same step", () => {
|
|
459
|
+
const clock = { t: T0 };
|
|
460
|
+
const { pane, events } = make(clock);
|
|
461
|
+
pane.setStep(demo("planned", { ask: { prompt: "go" } }));
|
|
462
|
+
const n = events.length;
|
|
463
|
+
pane.setStep(demo("planned", { ask: { prompt: "go" } }));
|
|
464
|
+
expect(events).toHaveLength(n);
|
|
465
|
+
});
|
|
466
|
+
it("shows the opening once and the closing at applied, without a ready light after it", () => {
|
|
467
|
+
const clock = { t: T0 };
|
|
468
|
+
const { pane, host, tick } = make(clock);
|
|
469
|
+
expect(pane.setStep(demo("pull-request", { opening: "Three states." }))).toBe(true);
|
|
470
|
+
expect(flat(host)).toContain("Three states.");
|
|
471
|
+
clock.t += 20000;
|
|
472
|
+
tick();
|
|
473
|
+
pane.setStep(demo("planned", { opening: "Three states.", ask: { action: "approve" } }));
|
|
474
|
+
expect(flat(host).split("Three states.")).toHaveLength(2);
|
|
475
|
+
clock.t += 20000;
|
|
476
|
+
tick();
|
|
477
|
+
pane.setStep(demo("applied", { closing: "3 states. 1 plan." }));
|
|
478
|
+
expect(flat(host)).toContain("3 states. 1 plan.");
|
|
479
|
+
expect(host.classes).not.toContain("ask-ready");
|
|
480
|
+
});
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
describe("ask mode (behold#939)", () => {
|
|
484
|
+
it("is on only while the pane shows in Watch", () => {
|
|
485
|
+
expect(askMode({ askOn: true, watchMode: true })).toBe(true);
|
|
486
|
+
expect(askMode({ askOn: true, watchMode: false })).toBe(false);
|
|
487
|
+
expect(askMode({ askOn: false, watchMode: true })).toBe(false);
|
|
488
|
+
expect(askMode(null)).toBe(false);
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
it("knows a step with a beat from one without", () => {
|
|
492
|
+
expect(hasAsk({ ask: { prompt: "p" } })).toBe(true);
|
|
493
|
+
expect(hasAsk({ asks: [{ reply: "r" }] })).toBe(true);
|
|
494
|
+
expect(hasAsk({ ask: null, asks: null, opening: "o" })).toBe(false);
|
|
495
|
+
expect(hasAsk(null)).toBe(false);
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
it("quiets event-help in ask mode: no bubble, modal, strip, waiting line or result", () => {
|
|
499
|
+
const h = { watch: true, held: false, hideTrail: false, waiting: { key: "k" }, result: { counts: ["3 created"] }, label: "x" };
|
|
500
|
+
expect(askEventHelp(h, true)).toEqual({ ...h, held: true, hideTrail: true, waiting: null, result: null });
|
|
501
|
+
expect(askEventHelp(h, false)).toBe(h);
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
it("turns any step's shot into the whole graph, asked to fill, in ask mode only", () => {
|
|
505
|
+
const shot = { id: "3|planned|change|app", kind: "change", roots: ["app"], waves: [2], whole: false };
|
|
506
|
+
expect(askShot(shot, true)).toEqual({ id: shot.id, kind: "whole", roots: [], waves: [], whole: true, ask: true });
|
|
507
|
+
expect(askShot(shot, false)).toBe(shot);
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
it("keeps the pane from shrinking within a scenario", () => {
|
|
511
|
+
expect(paneHeight(0, 120)).toBe(120);
|
|
512
|
+
expect(paneHeight(200, 120)).toBe(200);
|
|
513
|
+
expect(paneHeight(200, NaN)).toBe(200);
|
|
514
|
+
});
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
describe("diff under a reply", () => {
|
|
518
|
+
const beat = { prompt: "go", reply: "Opened pull request #12.", diff: ["+ network aws_subnet.subnet_b 10.0.2.0/24", "~ edge terraform_data.allowlist + 10.0.2.0/24", "- app old", 5, ""] };
|
|
519
|
+
const R = "Opened pull request #12.";
|
|
520
|
+
it("keeps strings only, and only under a reply", () => {
|
|
521
|
+
expect(diffLines(beat)).toHaveLength(3);
|
|
522
|
+
expect(diffLines({ prompt: "go", diff: ["+ a"] })).toEqual([]);
|
|
523
|
+
});
|
|
524
|
+
it("splits the sign column", () => {
|
|
525
|
+
expect(diffParts("+ network x")).toEqual({ sign: "+", rest: "network x" });
|
|
526
|
+
expect(diffParts("~ edge")).toEqual({ sign: "~", rest: "edge" });
|
|
527
|
+
expect(diffParts("plain")).toEqual({ sign: "", rest: "plain" });
|
|
528
|
+
});
|
|
529
|
+
it("lines appear one per DIFF_MS after the reply has typed, and the beat ends after them", () => {
|
|
530
|
+
const t = beatTiming(beat, { reply: R });
|
|
531
|
+
expect(t.diffMs).toBe(3 * DIFF_MS);
|
|
532
|
+
expect(t.end).toBe(t.replyAt + t.replyType + 3 * DIFF_MS);
|
|
533
|
+
const at = (ms) => playback([beat], ms, { replies: [R] }).frames[0];
|
|
534
|
+
const start = t.replyAt + t.replyType;
|
|
535
|
+
expect(at(start - 1).diffShown).toBe(0);
|
|
536
|
+
expect(at(start).diffShown).toBe(1);
|
|
537
|
+
expect(at(start + DIFF_MS).diffShown).toBe(2);
|
|
538
|
+
expect(at(start + 10 * DIFF_MS).diffShown).toBe(3);
|
|
539
|
+
expect(at(start + DIFF_MS).over).toBe(false);
|
|
540
|
+
expect(at(t.end).over).toBe(true);
|
|
541
|
+
});
|
|
542
|
+
it("shows at once under reduced motion", () => {
|
|
543
|
+
const f = playback([beat], 0, { reduced: true, replies: [R] }).frames[0];
|
|
544
|
+
expect(f.diffShown).toBe(3);
|
|
545
|
+
expect(f.over).toBe(true);
|
|
546
|
+
});
|
|
547
|
+
it("fires ask-done only after the diff has shown, and renders the lines", () => {
|
|
548
|
+
const T = Date.parse("2026-10-24T10:00:00Z");
|
|
549
|
+
const clock = { t: T };
|
|
550
|
+
const events = [];
|
|
551
|
+
const mk = (tag) => {
|
|
552
|
+
const n = { tag, className: "", textContent: "", children: [], hidden: false, attrs: {}, classes: [], ownerDocument: null };
|
|
553
|
+
n.classList = { add: (c) => n.classes.push(c), remove: () => {}, toggle: () => {} };
|
|
554
|
+
n.setAttribute = () => {};
|
|
555
|
+
n.append = (...c) => n.children.push(...c);
|
|
556
|
+
n.appendChild = (c) => n.children.push(c);
|
|
557
|
+
n.replaceChildren = (...c) => (n.children = c);
|
|
558
|
+
return n;
|
|
559
|
+
};
|
|
560
|
+
const host = mk("section");
|
|
561
|
+
host.ownerDocument = { createElement: mk };
|
|
562
|
+
let timer = null;
|
|
563
|
+
const pane = createAskPane({ host, win: { dispatchEvent: (e) => events.push(e.type) }, now: () => new Date(clock.t), setTimer: (f) => ((timer = f), 1), clearTimer: () => (timer = null) });
|
|
564
|
+
const two = { ...beat, diff: ["+ a", "~ b"] };
|
|
565
|
+
pane.setStep({ cycle: 1, scenario: "s", step: "pull-request", started_at: "2026-10-24T10:00:00Z", ask: two });
|
|
566
|
+
const t = beatTiming(two, { reply: R });
|
|
567
|
+
clock.t = T + t.replyAt + t.replyType + 1;
|
|
568
|
+
timer();
|
|
569
|
+
expect(events).not.toContain("behold:ask-done");
|
|
570
|
+
const all = (n) => [n.className, n.textContent, ...n.children.map(all)].join("|");
|
|
571
|
+
expect(all(host)).toContain("ask-diff-add");
|
|
572
|
+
expect(all(host)).not.toContain("ask-diff-chg");
|
|
573
|
+
clock.t = T + t.end + 1;
|
|
574
|
+
timer();
|
|
575
|
+
expect(all(host)).toContain("ask-diff-chg");
|
|
576
|
+
expect(events).toContain("behold:ask-done");
|
|
577
|
+
});
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
describe("newestLine", () => {
|
|
581
|
+
it("names the newest line, a diff belonging to its reply, and only changes its key when a new line starts", () => {
|
|
582
|
+
const turn = (parts, extra = {}) => ({ mark: ">", text: "go", parts, ...extra });
|
|
583
|
+
expect(newestLine([], false)).toBe(null);
|
|
584
|
+
expect(newestLine([turn([])], false)).toMatchObject({ kind: "prompt", part: -1 });
|
|
585
|
+
expect(newestLine([turn([{ k: "busy" }])], false)).toMatchObject({ kind: "busy", part: 0 });
|
|
586
|
+
const r1 = newestLine([turn([{ k: "sum" }, { k: "reply", text: "a" }])], false);
|
|
587
|
+
const r2 = newestLine([turn([{ k: "sum" }, { k: "reply", text: "ab" }, { k: "diff", lines: [] }])], false);
|
|
588
|
+
expect(r1).toMatchObject({ kind: "reply", part: 1 });
|
|
589
|
+
expect(r2.key).toBe(r1.key);
|
|
590
|
+
expect(newestLine([turn([])], true)).toMatchObject({ kind: "ready" });
|
|
591
|
+
expect(newestLine([turn([], { mark: "✓", text: "approve" })], false).kind).toBe("line");
|
|
592
|
+
});
|
|
593
|
+
});
|