]> khamidou — GitHub mirrors - electron.git/commitdiff
Add initial auto updater specs dont-use-es6-class-for-auto-updater
authorKevin Sawicki <kevinsawicki@gmail.com>
Wed, 3 Feb 2016 20:53:56 +0000 (12:53 -0800)
committerKevin Sawicki <kevinsawicki@gmail.com>
Tue, 9 Feb 2016 22:54:18 +0000 (14:54 -0800)
spec/api-auto-updater-spec.js [new file with mode: 0644]
spec/static/main.js

diff --git a/spec/api-auto-updater-spec.js b/spec/api-auto-updater-spec.js
new file mode 100644 (file)
index 0000000..72a1d90
--- /dev/null
@@ -0,0 +1,34 @@
+const assert = require('assert');
+const autoUpdater = require('electron').remote.autoUpdater;
+const ipcRenderer = require('electron').ipcRenderer;
+
+describe('autoUpdater module', function() {
+  describe('checkForUpdates', function() {
+    it('emits an error on Windows when called the feed URL is not set', function (done) {
+      if (process.platform !== 'win32') {
+        return done();
+      }
+
+      ipcRenderer.once('auto-updater-error', function(event, message) {
+        assert.equal(message, 'Update URL is not set');
+        done();
+      });
+      autoUpdater.setFeedURL('');
+      autoUpdater.checkForUpdates();
+    });
+  });
+
+  describe('setFeedURL', function() {
+    it('emits an error on Mac OS X when the application is unsigned', function (done) {
+      if (process.platform !== 'darwin') {
+        return done();
+      }
+
+      ipcRenderer.once('auto-updater-error', function(event, message) {
+        assert.equal(message, 'Could not get code signature for running application');
+        done();
+      });
+      autoUpdater.setFeedURL('');
+    });
+  });
+});
index 13d2dd6a6e10057e480798a688e1dcd528f98841..125ef72f609c37bbe04456960a7ac75dd0e8fc24 100644 (file)
@@ -72,6 +72,11 @@ app.on('ready', function() {
   // Test if using protocol module would crash.
   electron.protocol.registerStringProtocol('test-if-crashes', function() {});
 
+  // Send auto updater errors to window to be verified in specs
+  electron.autoUpdater.on('error', function (error) {
+    window.send('auto-updater-error', error.message)
+  });
+
   window = new BrowserWindow({
     title: 'Electron Tests',
     show: false,