test(server): wait for pending watchers before testing disposal (#8091)

Observation admission precedes asynchronous path resolution. Wait for subscriptions to start before disposal so the test consistently exercises late watcher cleanup.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
This commit is contained in:
paseo-bot[bot]
2026-10-28 06:13:41 +00:00
committed by GitHub
parent ce412d04c3
commit 53bbd7522d
@@ -797,6 +797,8 @@ describe("WorkspaceGitServiceImpl", () => {
cwds.forEach((cwd) => service.registerWorkspace({ cwd }, vi.fn()));
await vi.waitFor(() => {
// Admission precedes async path resolution; disposal must race pending subscriptions.
expect(subscribe).toHaveBeenCalledTimes(WORKSPACE_GIT_OBSERVATION_SETUP_CONCURRENCY);
expect(service.getMetrics()).toMatchObject({
workspaceRefreshAdmissionActiveCount: WORKSPACE_GIT_REFRESH_CONCURRENCY,
workspaceRefreshAdmissionPendingCount: 1,