From b8ae892af05a6bd373252f20c613b53217dfb5af Mon Sep 17 00:00:00 2001 From: iris salcedo Date: Mon, 13 Dec 2021 14:25:57 +0100 Subject: [PATCH 1/2] Test send update:available --- app/src/modules/autoUpdater.test.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/modules/autoUpdater.test.js b/app/src/modules/autoUpdater.test.js index e726e5dedf..fa95b926e4 100644 --- a/app/src/modules/autoUpdater.test.js +++ b/app/src/modules/autoUpdater.test.js @@ -96,7 +96,7 @@ describe('autoUpdater', () => { expect(params.autoUpdater.checkForUpdatesAndNotify).to.have.been.calledWithExactly(); }); - it.skip('should check for updates every 24 hours', () => { + it('should check for updates every 24 hours', () => { autoUpdater(params); expect(params.autoUpdater.checkForUpdatesAndNotify).to.have.callCount(1); clock.tick(24 * 60 * 60 * 1000); @@ -167,14 +167,17 @@ describe('autoUpdater', () => { expect(params.win.send).to.have.been.calledWith({ event: 'downloadUpdateStart' }); }); - /* it('should not download the update if update is available and the "Later" button was pressed', - () => { - autoUpdater(params); + it('should send update:available event when update is available', () => { + const newPrams = { ...params, electron }; + autoUpdater(newPrams); callbacks['update-available']({ version }); - callbacks.dialog(1); + expect(params.win.send).to.have.been.calledWith({ + event: 'update:available', + value: { releaseNotes: undefined, version }, + }); expect(params.autoUpdater.downloadUpdate).to.not.have.been.calledWith(); - }); */ + }); it('should set the progress bar when being in download progress', () => { autoUpdater(params); From f9d506286cd681e2b6aa31f88cc1c2a34e74614b Mon Sep 17 00:00:00 2001 From: iris salcedo Date: Mon, 13 Dec 2021 14:29:23 +0100 Subject: [PATCH 2/2] Add check for updates interval --- app/src/modules/autoUpdater.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/modules/autoUpdater.js b/app/src/modules/autoUpdater.js index 901583a010..f2231ec5ac 100644 --- a/app/src/modules/autoUpdater.js +++ b/app/src/modules/autoUpdater.js @@ -18,6 +18,9 @@ export default ({ // eslint-disable-line max-statements autoUpdater.autoDownload = false; autoUpdater.checkForUpdatesAndNotify(); + setInterval(() => { + autoUpdater.checkForUpdatesAndNotify(); + }, 24 * 60 * 60 * 1000); autoUpdater.on('error', (error) => { // eslint-disable-next-line no-console