From 6ee89947678b079790a2201e5d2b3ff9d7ab6623 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Sun, 9 Aug 2026 09:21:29 -0700 Subject: [PATCH] FN-8881: test Planning Mode image import parity Cover Planning Mode image-context import behavior at both responsive breakpoints. - Exercise desktop and mobile Planning Mode actions with image-bearing issue comments. - Assert provider metadata and every image-bearing body are forwarded without a client-side cap. Files changed: .../__tests__/GitHubImportModal.test.tsx | 58 ++++++++++++++-------- 1 file changed, 36 insertions(+), 22 deletions(-) Fusion-Task-Id: FN-8881 Fusion-Task-Lineage: e14cf0a6-a967-46ff-9d65-3e4fabbf9f45 Co-authored-by: Fusion (runfusion.ai) --- .../__tests__/GitHubImportModal.test.tsx | 54 ++++++++++++------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/packages/dashboard/app/components/__tests__/GitHubImportModal.test.tsx b/packages/dashboard/app/components/__tests__/GitHubImportModal.test.tsx index 56702134b2..48fb7eb50d 100644 --- a/packages/dashboard/app/components/__tests__/GitHubImportModal.test.tsx +++ b/packages/dashboard/app/components/__tests__/GitHubImportModal.test.tsx @@ -504,28 +504,42 @@ describe("GitHubImportModal", () => { })); }); - it("captures every loaded image-bearing comment in direct-import order without a client image budget", async () => { - const issue = { number: 48, title: "Comment screenshots", body: "![body](https://github.com/user-attachments/assets/body)", html_url: "https://github.com/dustinbyrne/kb/issues/48", labels: [], state: "open" }; - const unresolved = Array.from({ length: 12 }, (_, index) => `![bad-${index}](https://example.com/${index}.png)`).join("\n"); - const later = "![later](https://github.com/user-attachments/assets/later)"; - const onPlanningMode = vi.fn(); - vi.mocked(fetchGitRemotes).mockResolvedValueOnce(singleRemote); - vi.mocked(apiFetchGitHubIssues).mockResolvedValueOnce([issue]); - vi.mocked(apiFetchGitHubIssueDetail).mockResolvedValueOnce({ comments: [ - { author: "one", body: "plain prose only", createdAt: "2026-08-09T00:00:00Z", authorIsBot: false }, - { author: "two", body: unresolved, createdAt: "2026-08-09T00:01:00Z", authorIsBot: false }, - { author: "three", body: later, createdAt: "2026-08-09T00:02:00Z", authorIsBot: false }, - ] }); + /* + FNXC:GitHubPlanningSourceIssue 2026-08-09-16:05: + Planning's desktop and mobile action rows must transport identical body-plus-comment image context. + The client deliberately sends all image-bearing bodies; the server alone applies the policy-resolved image cap. + */ + it.each([["desktop", 1200], ["mobile", 480]] as const)("captures every loaded image-bearing comment at the %s breakpoint without a client image budget", async (_breakpoint, width) => { + const originalInnerWidth = window.innerWidth; + Object.defineProperty(window, "innerWidth", { writable: true, configurable: true, value: width }); + window.dispatchEvent(new Event("resize")); + try { + const issue = { number: 48, title: "Comment screenshots", body: "![body](https://github.com/user-attachments/assets/body)", html_url: "https://github.com/dustinbyrne/kb/issues/48", labels: [], state: "open" }; + const unresolved = Array.from({ length: 12 }, (_, index) => `![bad-${index}](https://example.com/${index}.png)`).join("\n"); + const later = "![later](https://github.com/user-attachments/assets/later)"; + const onPlanningMode = vi.fn(); + vi.mocked(fetchGitRemotes).mockResolvedValueOnce(singleRemote); + vi.mocked(apiFetchGitHubIssues).mockResolvedValueOnce([issue]); + vi.mocked(apiFetchGitHubIssueDetail).mockResolvedValueOnce({ comments: [ + { author: "one", body: "plain prose only", createdAt: "2026-08-09T00:00:00Z", authorIsBot: false }, + { author: "two", body: unresolved, createdAt: "2026-08-09T00:01:00Z", authorIsBot: false }, + { author: "three", body: later, createdAt: "2026-08-09T00:02:00Z", authorIsBot: false }, + ] }); - render(); - fireEvent.click(await screen.findByRole("button", { name: /Select issue #48/i })); - await waitFor(() => expect(apiFetchGitHubIssueDetail).toHaveBeenCalledWith("dustinbyrne/kb", 48)); - await act(async () => { await Promise.resolve(); }); - fireEvent.click(screen.getByTestId("github-import-action-plan")); + render(); + fireEvent.click(await screen.findByRole("button", { name: /Select issue #48/i })); + await waitFor(() => expect(apiFetchGitHubIssueDetail).toHaveBeenCalledWith("dustinbyrne/kb", 48)); + await act(async () => { await Promise.resolve(); }); + fireEvent.click(screen.getByTestId("github-import-action-plan")); - expect(onPlanningMode.mock.calls[0]?.[2]).toEqual(expect.objectContaining({ - imageBodies: [issue.body, unresolved, later], - })); + expect(onPlanningMode.mock.calls[0]?.[2]).toEqual(expect.objectContaining({ + provider: "github", + imageBodies: [issue.body, unresolved, later], + })); + } finally { + Object.defineProperty(window, "innerWidth", { writable: true, configurable: true, value: originalInnerWidth }); + window.dispatchEvent(new Event("resize")); + } }); /*