-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathprogress.test.js
More file actions
35 lines (31 loc) · 1.03 KB
/
Copy pathprogress.test.js
File metadata and controls
35 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { describe, expect, test } from "bun:test";
import { createProgressTracker } from "./progress.js";
describe("progress tracker", () => {
test("can start typing without a visible progress message", async () => {
const calls = [];
const ctx = {
api: {
sendMessage: async (...args) => {
calls.push(["sendMessage", ...args]);
return { message_id: 123 };
},
sendChatAction: async (...args) => {
calls.push(["sendChatAction", ...args]);
},
editMessageText: async (...args) => {
calls.push(["editMessageText", ...args]);
},
deleteMessage: async (...args) => {
calls.push(["deleteMessage", ...args]);
},
},
};
const progress = createProgressTracker(ctx, -100, 1, "CC");
await progress.start({ visibleMessage: false });
progress.processEvent({ type: "progress", toolName: "Read" });
await progress.finish();
expect(calls).toEqual([
["sendChatAction", -100, "typing"],
]);
});
});