mirror of
https://github.com/multica-ai/multica.git
synced 2026-08-02 18:13:27 +02:00
test(desktop): stabilize updater preference test against slow-disk race
The "skips startup and periodic checks when automatic updates are disabled" case advanced fake timers without awaiting the async preference load. On slow CI the in-flight readFile resolved after afterEach() removed the temp dir, defaulted enabled back to true, and fired a deferred background check into the next test's freshly-cleared shared mock — making "persists the automatic update preference and stops future background checks" flake with checkForUpdates called once. Await updater:get-preferences (which awaits preferencesReady) before advancing timers so the read settles against the existing file and no background work outlives the test. Test-only change; production behavior is unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -160,6 +160,12 @@ describe("setupAutoUpdater", () => {
|
||||
);
|
||||
setupAutoUpdater(() => null);
|
||||
|
||||
// Let the async preference load settle before advancing timers; otherwise
|
||||
// the in-flight readFile can resolve after afterEach() removes the temp
|
||||
// dir, default back to enabled=true, and fire a background check into the
|
||||
// next test's freshly-cleared mock (flake on slow CI).
|
||||
await invokeIpc("updater:get-preferences");
|
||||
|
||||
await vi.advanceTimersByTimeAsync(60 * 60 * 1000 + 5_000);
|
||||
|
||||
expect(ctx.checkForUpdates).not.toHaveBeenCalled();
|
||||
|
||||
Reference in New Issue
Block a user