fix(frontend): track playback completion and meaningful inactivity
This commit is contained in:
@@ -247,4 +247,18 @@ describe("voice application lifecycle", () => {
|
||||
expect(client.close).toHaveBeenCalledOnce();
|
||||
expect(controller.getSnapshot().status).toBe("closed");
|
||||
});
|
||||
it("does not count native processing or an external answer request as user inactivity", async () => {
|
||||
const client = await start();
|
||||
client.emit("status", "processing");
|
||||
await vi.advanceTimersByTimeAsync(60000);
|
||||
expect(client.close).not.toHaveBeenCalled();
|
||||
client.emit("transcript", { id: "u1", role: "user", text: "Consulta lenta", partial: false });
|
||||
client.emit("status", "listening");
|
||||
await vi.advanceTimersByTimeAsync(60000);
|
||||
expect(client.close).not.toHaveBeenCalled();
|
||||
expect(controller.getSnapshot().status).toBe("processing");
|
||||
pendingReasoning?.(new Response(JSON.stringify({ answer: "Respuesta" })));
|
||||
await vi.advanceTimersByTimeAsync(1);
|
||||
expect(controller.getSnapshot().status).toBe("listening");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user