Skip to content

Commit 3f53d4e

Browse files
committed
chore(compass): adjust unit test for new download behavior
1 parent 9a1e640 commit 3f53d4e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/compass/src/main/auto-update-manager.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
CompassAutoUpdateManager,
77
} from './auto-update-manager';
88
import type { DownloadItem } from 'electron';
9-
import { dialog, autoUpdater } from 'electron';
9+
import { dialog, autoUpdater, BrowserWindow } from 'electron';
1010
import os from 'os';
1111
import dl from 'electron-dl';
1212
import { createSandboxFromDefaultPreferences } from 'compass-preferences-model';
@@ -344,6 +344,10 @@ describe('CompassAutoUpdateManager', function () {
344344
return Promise.resolve({ response: 0, checkboxChecked: false });
345345
});
346346

347+
sandbox.stub(BrowserWindow, 'getAllWindows').callsFake(() => {
348+
return [{} as BrowserWindow];
349+
});
350+
347351
const stub = sandbox.stub(dl, 'download').callsFake(() => {
348352
return Promise.resolve({} as DownloadItem);
349353
});
@@ -356,6 +360,10 @@ describe('CompassAutoUpdateManager', function () {
356360
)
357361
).to.eq(true);
358362

363+
// Any small timeout will do, we're allowing for the async tasks to
364+
// clear
365+
await wait(300);
366+
359367
expect(stub).to.be.calledOnce;
360368
});
361369

0 commit comments

Comments
 (0)