test(FN-4306): complete Step 4 — add capacity banner gating coverage

Fusion-Task-Id: FN-4306
Fusion-Task-Lineage: b0ab9b60-de02-40a7-ad8b-0ca18c98e16c
This commit is contained in:
Fusion
2026-05-13 06:36:11 -07:00
committed by gsxdsm
parent 7edd2a58b4
commit 196194d8d9
3 changed files with 76 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ describe("useAppSettings", () => {
taskStuckTimeoutMs: 600000,
staleHighFanoutBlockerAgeThresholdMs: 7200000,
showQuickChatFAB: false,
capacityRiskBannerEnabled: false,
} as never);
mockUpdateSettings.mockResolvedValue({} as never);
@@ -49,6 +50,8 @@ describe("useAppSettings", () => {
expect(result.current.taskStuckTimeoutMs).toBe(600000);
expect(result.current.staleHighFanoutBlockerAgeThresholdMs).toBe(7200000);
expect(result.current.showQuickChatFAB).toBe(false);
expect(result.current.capacityRiskBannerEnabled).toBe(false);
expect(result.current.capacityRiskTodoThreshold).toBe(20);
});
expect(mockFetchConfig).toHaveBeenCalledWith("proj_123");
@@ -117,6 +120,26 @@ describe("useAppSettings", () => {
);
});
it("propagates capacity risk settings from fetchSettings", async () => {
mockFetchSettings.mockResolvedValueOnce({
autoMerge: false,
globalPause: true,
enginePaused: false,
prAuthAvailable: true,
taskStuckTimeoutMs: 600000,
showQuickChatFAB: false,
capacityRiskBannerEnabled: true,
capacityRiskTodoThreshold: 30,
} as never);
const { result } = renderHook(() => useAppSettings("proj_123"));
await waitFor(() => {
expect(result.current.capacityRiskBannerEnabled).toBe(true);
expect(result.current.capacityRiskTodoThreshold).toBe(30);
});
});
it("refresh() re-fetches and updates state", async () => {
const { result } = renderHook(() => useAppSettings("proj_123"));