feat(FN-4552): complete Step 2 — harden openFiles workspace guards

Fusion-Task-Id: FN-4552
Fusion-Task-Lineage: dad48f2c-25a8-4fca-8f00-16307936621c
This commit is contained in:
Fusion
2026-05-14 20:54:08 -07:00
committed by gsxdsm
parent b6c346bb7b
commit 002d148c78
2 changed files with 27 additions and 3 deletions

View File

@@ -229,6 +229,24 @@ describe("useModalManager", () => {
expect(result.current.fileBrowserInitialFile).toBeNull();
});
it("ignores non-string workspace values in openFiles and keeps existing workspace", () => {
const { result } = renderHook(() =>
useModalManager({ projectId: "proj_1", planningSessions: [] }),
);
act(() => {
result.current.openFiles("FN-123", "packages/dashboard/app/App.tsx");
});
act(() => {
result.current.openFiles({ type: "click" } as unknown as string, { path: "bad" } as unknown as string);
});
expect(result.current.fileBrowserWorkspace).toBe("FN-123");
expect(result.current.fileBrowserInitialFile).toBeNull();
expect(result.current.filesOpen).toBe(true);
});
it("accepts plain Task object in openDetailWithChangesTab", () => {
const task = createTask("FN-789");
const { result } = renderHook(() =>