Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.

Commit 1a55130

Browse files
committed
Add test for empty todo list handling
1 parent 8276ed1 commit 1a55130

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

__tests__/index.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,4 +552,18 @@ describe("TaskContinuation", () => {
552552
// Countdown should have fired despite multiple message updates
553553
expect(ctx.client.session.prompt).toHaveBeenCalled()
554554
})
555+
556+
it("should not inject continuation when todo list is empty", async () => {
557+
const ctx = createMockContext()
558+
const mockTodoFn = ctx.client.session.todo as unknown as {
559+
mockResolvedValue: (val: Todo[]) => void
560+
}
561+
mockTodoFn.mockResolvedValue([])
562+
563+
const taskContinuation = createTaskContinuation(ctx)
564+
await taskContinuation.handler({ event: createIdleEvent("session-empty") })
565+
566+
await vi.advanceTimersByTimeAsync(3000)
567+
expect(ctx.client.session.prompt).not.toHaveBeenCalled()
568+
})
555569
})

0 commit comments

Comments
 (0)