mirror of
https://github.com/davidkaya/aryx.git
synced 2026-07-24 13:38:43 +02:00
fix: enable background update checks in dev builds
Remove the isPackaged guard from AutoUpdateService.start() so that background update checks run in both packaged and dev builds. forceDevUpdateConfig already handles dev-mode config correctly via dev-app-update.yml — the start() gate was preventing the 10s initial check and 4h periodic checks from ever being scheduled in dev. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -192,7 +192,7 @@ export class AutoUpdateService {
|
||||
}
|
||||
|
||||
start(): void {
|
||||
if (this.started || !this.options.isPackaged) {
|
||||
if (this.started) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,18 +64,20 @@ class FakeScheduler implements AutoUpdateScheduler {
|
||||
}
|
||||
|
||||
describe('AutoUpdateService', () => {
|
||||
test('does not schedule checks for unpackaged apps but manual checks still work', async () => {
|
||||
test('schedules checks for unpackaged apps using dev update config', async () => {
|
||||
const updater = new FakeUpdater();
|
||||
const scheduler = new FakeScheduler();
|
||||
const service = new AutoUpdateService({ isPackaged: false, scheduler, updater });
|
||||
|
||||
service.start();
|
||||
|
||||
expect(scheduler.timeouts).toHaveLength(0);
|
||||
expect(scheduler.intervals).toHaveLength(0);
|
||||
expect(updater.forceDevUpdateConfig).toBe(true);
|
||||
expect(scheduler.timeouts).toEqual([{ callback: expect.any(Function), delayMs: 10_000 }]);
|
||||
expect(scheduler.intervals).toEqual([{ callback: expect.any(Function), delayMs: 4 * 60 * 60 * 1000 }]);
|
||||
|
||||
await scheduler.runTimeout();
|
||||
await Promise.resolve();
|
||||
|
||||
await service.checkForUpdates();
|
||||
expect(updater.checkForUpdatesCalls).toBe(1);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user