feat(FN-4646): complete Step 4 — prefer landed file metadata in dashboard
Fusion-Task-Id: FN-4646 Fusion-Task-Lineage: f921098e-3407-40fa-984d-720e0c3248c7
This commit is contained in:
@@ -2444,6 +2444,31 @@ describe("TaskCard", () => {
|
||||
expect(filesChangedButton).toBeNull();
|
||||
});
|
||||
|
||||
it("prefers landedFiles fallback label for done tasks when lineage stats are unavailable", () => {
|
||||
const onOpenDetailWithTab = vi.fn();
|
||||
useTaskDiffStatsMock.mockReturnValue({ stats: null, loading: false });
|
||||
|
||||
render(
|
||||
<TaskCard
|
||||
task={makeTask({
|
||||
column: "done",
|
||||
mergeDetails: { landedFiles: ["a.ts", "b.ts"] },
|
||||
modifiedFiles: ["a.ts", "b.ts", "c.ts", "d.ts", "e.ts", "f.ts"],
|
||||
})}
|
||||
onOpenDetail={noop}
|
||||
addToast={noop}
|
||||
onOpenDetailWithTab={onOpenDetailWithTab}
|
||||
/>,
|
||||
);
|
||||
|
||||
const landedButton = screen.getByRole("button", { name: "2 files in merged commit" });
|
||||
expect(landedButton).toBeDefined();
|
||||
|
||||
fireEvent.click(landedButton);
|
||||
expect(onOpenDetailWithTab).toHaveBeenCalledTimes(1);
|
||||
expect(onOpenDetailWithTab.mock.calls[0]?.[1]).toBe("changes");
|
||||
});
|
||||
|
||||
it("shows execution-touched fallback label for done tasks when lineage stats are unavailable", () => {
|
||||
const onOpenDetailWithTab = vi.fn();
|
||||
useTaskDiffStatsMock.mockReturnValue({ stats: null, loading: false });
|
||||
|
||||
@@ -570,7 +570,31 @@ describe("TaskChangesTab — regression: non-done tasks and done-without-commitS
|
||||
expect(mockFetchTaskDiff).toHaveBeenCalledWith("FN-001", undefined, undefined);
|
||||
});
|
||||
|
||||
it("done task without commitSha falls back to modifiedFiles when available", async () => {
|
||||
it("done task without commitSha prefers landedFiles over stale modifiedFiles", async () => {
|
||||
mockFetchTaskDiff.mockResolvedValue({ files: [], stats: { filesChanged: 0, additions: 0, deletions: 0 } });
|
||||
|
||||
render(
|
||||
<TaskChangesTab
|
||||
taskId="FN-001"
|
||||
worktree={undefined}
|
||||
column="done"
|
||||
mergeDetails={{ filesChanged: 0, insertions: 0, deletions: 0, landedFiles: ["packages/cli/src/commands/__tests__/settings.test.ts"] }}
|
||||
modifiedFiles={["packages/cli/src/commands/__tests__/settings.test.ts", "packages/cli/src/commands/__tests__/task.test.ts"]}
|
||||
/>,
|
||||
);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("1 file in the merged commit.")).toBeTruthy();
|
||||
});
|
||||
expect(screen.getByText("These are files captured from the merged commit metadata. The lineage-backed diff is unavailable for this task.")).toBeTruthy();
|
||||
expect(screen.getByText("packages/cli/src/commands/__tests__/settings.test.ts")).toBeTruthy();
|
||||
expect(screen.queryByText("packages/cli/src/commands/__tests__/task.test.ts")).toBeNull();
|
||||
expect(screen.queryByText(/Error loading changes:/)).toBeNull();
|
||||
expect(screen.queryByText("Files Changed (2)")).toBeNull();
|
||||
expect(mockFetchTaskDiff).toHaveBeenCalledWith("FN-001", undefined, undefined);
|
||||
});
|
||||
|
||||
it("done task without commitSha falls back to modifiedFiles when landedFiles unavailable", async () => {
|
||||
mockFetchTaskDiff.mockResolvedValue({ files: [], stats: { filesChanged: 0, additions: 0, deletions: 0 } });
|
||||
|
||||
render(
|
||||
|
||||
Reference in New Issue
Block a user