Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

test(voice): wait for the next update instead of a fixed sleep

LeoXing3de304f6b800
diff --git a/apps/voice-runtime/src/live-worker.test.ts b/apps/voice-runtime/src/live-worker.test.ts
index cd08c707..079aee3b 100644
--- a/apps/voice-runtime/src/live-worker.test.ts
+++ b/apps/voice-runtime/src/live-worker.test.ts
@@ -1451,9 +1451,13 @@ describe("LiveVoiceWorker background work", () => {
{ type: "update_accepted", id },
{ type: "response_finished", canceled: false, updateId: id },
);
- await new Promise((resolve) => setTimeout(resolve, 300));
+ // Once it is given up the next update is told, and nothing more of it.
+ test.setAlerts([{ alert_id: "a2", text: "Max @you" }]);
+ await vi.waitFor(() =>
+ expect(test.session().tell).toHaveBeenCalledTimes(2),
+ );
+ expect(test.session().tell.mock.calls[1]![2]).not.toBe(id);
expect(test.session().repeatUpdate).toHaveBeenCalledTimes(2);
- expect(test.session().tell).toHaveBeenCalledOnce();
expect(test.session().abandon).not.toHaveBeenCalled();
await test.shutdown();
});