fix: subscribe to model activity events

This commit is contained in:
User
2026-07-14 15:14:25 +02:00
parent f21df47bce
commit bc02213d3e
2 changed files with 18 additions and 1 deletions
@@ -22,6 +22,17 @@ test("opens an EventSource and feeds NAMED events to the store", () => {
expect(useSessionStore.getState().pendingWidget?.id).toBe("u1");
});
test("feeds named activity_delta events to the model activity store", () => {
renderHook(() => useSessionStream("s1"));
const es = FakeEventSource.instances[0];
act(() =>
es.emitNamed("activity_delta", { type: "activity_delta", text: "Analizzo le ambiguità" })
);
expect(useSessionStore.getState().activity.at(-1)?.text).toBe("Analizzo le ambiguità");
});
test("also feeds UNNAMED (default message) events to the store", () => {
renderHook(() => useSessionStream("s1"));
const es = FakeEventSource.instances[0];