test(server): stub the background fetch in the no-upstream origin/main test

The test's checkout has a remote URL, which starts the background fetch,
and it was the only one not stubbing runGitFetch, so it ran real git.
A remote-ref event that lands during a fetch is buffered until the fetch
ends, so on a loaded runner the second refresh arrived after the 1s
waitFor. Under local CPU load it failed 12 of 20 runs before, 0 of 20
after.
This commit is contained in:
paseo-bot[bot]
2026-09-23 21:52:12 +02:00
parent 48b16353e9
commit 4a97a60e5a
@@ -1006,7 +1006,13 @@ describe("WorkspaceGitService checkout observation", () => {
branchMergeRef: null,
upstreamStatus: null,
}));
const service = createService(watcher, { getCheckoutSnapshotFacts });
// A remote URL starts the background fetch; keep it off the real git binary.
const runGitFetch = vi.fn(async () => ({
changes: [],
nonRemoteRefsChanged: false,
error: null,
}));
const service = createService(watcher, { getCheckoutSnapshotFacts, runGitFetch });
const subscription = service.registerWorkspace({ cwd: REPO_CWD }, vi.fn());
await vi.waitFor(() => {
expect(getCheckoutSnapshotFacts).toHaveBeenCalledTimes(1);