fix(dashboard): ensure file/import API calls are project-scoped in tests

Update 4 test files to pass projectId="project-1" to hooks/components
and assert it flows through to the API layer:
- useFileBrowser: fetchFileList receives (taskId, path, projectId)
- useFileEditor: fetchFileContent/saveFileContent receive projectId
- FileBrowser: deleteFile/renameFile/copyFile/moveFile receive projectId
- GitHubImportModal: apiImportGitHubIssue/Pull receive projectId

All 6653 tests pass across 242 test files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-12 21:40:34 -07:00
parent e5b1bb1abe
commit a10dfe5f21
4 changed files with 20 additions and 19 deletions

View File

@@ -67,7 +67,7 @@ describe("useFileEditor", () => {
it("fetches file content when enabled and filePath is set", async () => {
mockFetchFileContent.mockResolvedValueOnce(contentResponse("file body"));
const { result } = renderHook(() => useFileEditor("FN-001", "README.md", true));
const { result } = renderHook(() => useFileEditor("FN-001", "README.md", true, "project-1"));
await waitFor(() => {
expect(result.current.loading).toBe(true);
@@ -78,7 +78,7 @@ describe("useFileEditor", () => {
expect(result.current.content).toBe("file body");
});
expect(mockFetchFileContent).toHaveBeenCalledWith("FN-001", "README.md");
expect(mockFetchFileContent).toHaveBeenCalledWith("FN-001", "README.md", "project-1");
});
it("sets content and originalContent from fetch response", async () => {
@@ -164,7 +164,7 @@ describe("useFileEditor", () => {
mockFetchFileContent.mockResolvedValueOnce(contentResponse("original"));
mockSaveFileContent.mockResolvedValueOnce(saveResponse());
const { result } = renderHook(() => useFileEditor("FN-001", "file.txt", true));
const { result } = renderHook(() => useFileEditor("FN-001", "file.txt", true, "project-1"));
await waitFor(() => {
expect(result.current.loading).toBe(false);
@@ -178,7 +178,7 @@ describe("useFileEditor", () => {
await result.current.save();
});
expect(mockSaveFileContent).toHaveBeenCalledWith("FN-001", "file.txt", "updated");
expect(mockSaveFileContent).toHaveBeenCalledWith("FN-001", "file.txt", "updated", "project-1");
});
it("save updates originalContent and mtime after success", async () => {