feat(FN-3466): add mutation coverage for agent view refreshes
Adds deterministic split-pane refresh behavior to the Agents views (AgentsView and AgentDetailView), with comprehensive test coverage for the mutation refreshes in the detail pane and the agents hook. Fusion-Task-Id: FN-3466
This commit is contained in:
@@ -118,6 +118,25 @@ describe("useAgents", () => {
|
||||
expect(mockFetchAgents).toHaveBeenLastCalledWith({ state: "active", role: "executor", includeEphemeral: false }, undefined);
|
||||
});
|
||||
|
||||
it("refreshAgents reloads both list and stats in one call", async () => {
|
||||
const { result } = renderHook(() => useAgents());
|
||||
|
||||
await waitFor(() => {
|
||||
expect(mockFetchAgents).toHaveBeenCalled();
|
||||
expect(mockFetchAgentStats).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
mockFetchAgents.mockClear();
|
||||
mockFetchAgentStats.mockClear();
|
||||
|
||||
await act(async () => {
|
||||
await result.current.refreshAgents();
|
||||
});
|
||||
|
||||
expect(mockFetchAgents).toHaveBeenCalledTimes(1);
|
||||
expect(mockFetchAgentStats).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it("handles fetchAgents rejection gracefully", async () => {
|
||||
mockFetchAgents.mockRejectedValueOnce(new Error("agents failed"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user