mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-28 12:12:47 +00:00
test(server): wait for Git observation before completing fetch
The structural fallback test advanced its debounce timer before asynchronous watcher setup and fetch completion. Wait for those stages so slow filesystem setup does not turn the intended refresh assertion into a scheduling race.
This commit is contained in:
@@ -1105,12 +1105,23 @@ describe("WorkspaceGitServiceImpl", () => {
|
||||
{ cwd: join(REPO_CWD, "packages", "server") },
|
||||
vi.fn(),
|
||||
);
|
||||
await vi.waitFor(() => {
|
||||
expect(getCheckoutSnapshotFacts).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
await vi.waitFor(
|
||||
() => {
|
||||
expect(getCheckoutSnapshotFacts).toHaveBeenCalledTimes(2);
|
||||
expect(service.getMetrics()).toMatchObject({
|
||||
repositoryWorkspaceLinkCount: 2,
|
||||
workspaceObservationSetupInFlightCount: 0,
|
||||
workspaceRefreshInFlightCount: 0,
|
||||
fetchInFlightCount: 1,
|
||||
});
|
||||
},
|
||||
{ timeout: 10_000 },
|
||||
);
|
||||
|
||||
releaseFetch.resolve();
|
||||
await flushPromises();
|
||||
await vi.waitFor(() => {
|
||||
expect(service.getMetrics().fetchInFlightCount).toBe(0);
|
||||
});
|
||||
await vi.advanceTimersByTimeAsync(1_000);
|
||||
await vi.waitFor(() => {
|
||||
expect(getCheckoutSnapshotFacts).toHaveBeenCalledTimes(4);
|
||||
|
||||
Reference in New Issue
Block a user