Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

test(rows-hold-still): measure another bot's work before the hand-over (#6622)

Milind Soni8b8d5a51ed96
diff --git a/src/components/ChatView.rows-hold-still.test.ts b/src/components/ChatView.rows-hold-still.test.ts
index bfae294c79..af3e1fe2ba 100644
--- a/src/components/ChatView.rows-hold-still.test.ts
+++ b/src/components/ChatView.rows-hold-still.test.ts
@@ -116,6 +116,21 @@ describe("a long chat on screen", () => {
}
});
+ it("draws no row again while another bot works", async () => {
+ const mark = renderMark();
+ await send({ kind: "bot", bot: { ...announced("a", "Ada"), busy: true, activity: "working" } });
+ await runtime("a-thread", { type: "turn.started" });
+ for (let word = 0; word < 5; word++) await say("a-thread", `other${word} `);
+ await send({ kind: "message", threadId: "a-thread", message: { id: "a1", at: start, role: "bot", kind: "text", text: "Done." } });
+ await send({ kind: "bot", bot: { ...announced("a", "Ada"), busy: false, activity: "idle", tasks: [
+ ...announced("a", "Ada").tasks!, { threadId: "a-fork", title: "Fork", createdAt: 2, approvalMode: "ask", origin: { threadId: "a-thread", messageId: "a1" } },
+ ] } });
+ flushSync(() => dispatch({ type: "connected", value: false }));
+ flushSync(() => dispatch({ type: "connected", value: true }));
+ await settle();
+ expect(countBy(renderedSince(mark).filter((entry) => entry.row !== null), (entry) => entry.component)).toEqual(new Map());
+ });
+
it("draws no saved row again while a reply streams in", async () => {
await send({ kind: "bot", bot: { ...announced("b", "Bea"), busy: true, activity: "working" } });
await runtime("b-thread", { type: "turn.started" });
@@ -141,19 +156,4 @@ describe("a long chat on screen", () => {
expect(rows).toEqual(new Set(["live:live-item", "b-saved"]));
expect(renderedSince(mark).filter((entry) => entry.component === "TurnNarrationRun"), "a folded turn above").toEqual([]);
});
-
- it("draws no row again while another bot works", async () => {
- const mark = renderMark();
- await send({ kind: "bot", bot: { ...announced("a", "Ada"), busy: true, activity: "working" } });
- await runtime("a-thread", { type: "turn.started" });
- for (let word = 0; word < 5; word++) await say("a-thread", `other${word} `);
- await send({ kind: "message", threadId: "a-thread", message: { id: "a1", at: start, role: "bot", kind: "text", text: "Done." } });
- await send({ kind: "bot", bot: { ...announced("a", "Ada"), busy: false, activity: "idle", tasks: [
- ...announced("a", "Ada").tasks!, { threadId: "a-fork", title: "Fork", createdAt: 2, approvalMode: "ask", origin: { threadId: "a-thread", messageId: "a1" } },
- ] } });
- flushSync(() => dispatch({ type: "connected", value: false }));
- flushSync(() => dispatch({ type: "connected", value: true }));
- await settle();
- expect(countBy(renderedSince(mark).filter((entry) => entry.row !== null), (entry) => entry.component)).toEqual(new Map());
- });
});