feat(FN-2092): merge fusion/fn-2092

This commit is contained in:
gsxdsm
2026-04-18 22:07:20 -07:00
parent b0028c077f
commit 4e3e2ca7fe
6 changed files with 115 additions and 8 deletions

View File

@@ -81,6 +81,24 @@ describe("useBackgroundSessions", () => {
});
});
it("logs a warning when fetching background sessions fails", async () => {
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const networkError = new Error("Network error");
mockFetchAiSessions.mockRejectedValueOnce(networkError);
const { result } = renderHook(() => useBackgroundSessions());
await waitFor(() => {
expect(warnSpy).toHaveBeenCalledWith(
"[useBackgroundSessions] Failed to fetch AI sessions:",
networkError,
);
});
expect(result.current.sessions).toEqual([]);
warnSpy.mockRestore();
});
it("applies SSE-driven session updates reactively", async () => {
const { result } = renderHook(() => useBackgroundSessions());