From 6f4c1996297a985247471fbc14b16587f19b7d82 Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Wed, 5 Aug 2026 12:02:22 -0400 Subject: [PATCH] fix(tui): wait for diff request in tests (#40670) --- packages/tui/test/cli/tui/diff-viewer.test.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/tui/test/cli/tui/diff-viewer.test.tsx b/packages/tui/test/cli/tui/diff-viewer.test.tsx index d6bf8b78a1b..d40b2d448ac 100644 --- a/packages/tui/test/cli/tui/diff-viewer.test.tsx +++ b/packages/tui/test/cli/tui/diff-viewer.test.tsx @@ -147,12 +147,12 @@ async function renderDiffViewer(vcsDiff: unknown[], height = 20, initialRoute?: const config = createTuiResolvedConfig() const transport = createFetch((url) => { if (url.pathname !== "/api/vcs/diff") return - if (fail) return json({ message: "boom" }, { status: 500 }) vcsDiffInput = { location: { directory: url.searchParams.get("location[directory]") }, mode: url.searchParams.get("mode"), context: url.searchParams.get("context"), } + if (fail) return json({ message: "boom" }, { status: 500 }) return json({ location: { directory: "/repo/session", project: { id: "project-1", directory: "/repo/session" } }, data: vcsDiff, @@ -238,6 +238,7 @@ async function renderDiffViewer(vcsDiff: unknown[], height = 20, initialRoute?: const app = await testRender(() => , { width: 80, height }) await waitForCommand(app, commands, "diff.close") + await app.waitFor(() => vcsDiffInput !== undefined) return { app, commands,