fix windows tests
This commit is contained in:
parent
549042160f
commit
a20b379f26
2 changed files with 27 additions and 23 deletions
|
@ -19,12 +19,16 @@ class AutoUpdater extends EventEmitter {
|
||||||
|
|
||||||
setFeedURL (options) {
|
setFeedURL (options) {
|
||||||
let updateURL
|
let updateURL
|
||||||
if (typeof options === 'string') {
|
if (typeof options === 'object') {
|
||||||
|
if (typeof options.url === 'string') {
|
||||||
|
updateURL = options.url
|
||||||
|
} else {
|
||||||
|
throw new Error('Expected options object to contain a \'url\' string property in setFeedUrl call')
|
||||||
|
}
|
||||||
|
} else if (typeof options === 'string') {
|
||||||
updateURL = options
|
updateURL = options
|
||||||
} else if (typeof options === 'object' && typeof options.url === 'string') {
|
|
||||||
updateURL = options.url
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Expected options.url to be a string but none was provided')
|
throw new Error('Expected an options object with a \'url\' property to be provided')
|
||||||
}
|
}
|
||||||
this.updateURL = updateURL
|
this.updateURL = updateURL
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,25 @@ describe('autoUpdater module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('getFeedURL', function () {
|
||||||
|
it('returns a falsey value by default', function () {
|
||||||
|
assert.ok(!autoUpdater.getFeedURL())
|
||||||
|
})
|
||||||
|
|
||||||
|
it('correctly fetches the previously set FeedURL', function (done) {
|
||||||
|
if (process.platform !== 'win32') {
|
||||||
|
// FIXME(alexeykuzmin): Skip the test.
|
||||||
|
// this.skip()
|
||||||
|
return done()
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateURL = 'https://fake-update.electron.io'
|
||||||
|
autoUpdater.setFeedURL(updateURL)
|
||||||
|
assert.equal(autoUpdater.getFeedURL(), updateURL)
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('setFeedURL', function () {
|
describe('setFeedURL', function () {
|
||||||
describe('on Mac or Windows', () => {
|
describe('on Mac or Windows', () => {
|
||||||
const noThrow = (fn) => {
|
const noThrow = (fn) => {
|
||||||
|
@ -106,25 +125,6 @@ describe('autoUpdater module', function () {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('getFeedURL', function () {
|
|
||||||
it('returns a falsey value by default', function () {
|
|
||||||
assert.ok(!autoUpdater.getFeedURL())
|
|
||||||
})
|
|
||||||
|
|
||||||
it('correctly fetches the previously set FeedURL', function (done) {
|
|
||||||
if (process.platform !== 'win32') {
|
|
||||||
// FIXME(alexeykuzmin): Skip the test.
|
|
||||||
// this.skip()
|
|
||||||
return done()
|
|
||||||
}
|
|
||||||
|
|
||||||
const updateURL = 'https://fake-update.electron.io'
|
|
||||||
autoUpdater.setFeedURL(updateURL)
|
|
||||||
assert.equal(autoUpdater.getFeedURL(), updateURL)
|
|
||||||
done()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('quitAndInstall', function () {
|
describe('quitAndInstall', function () {
|
||||||
it('emits an error on Windows when no update is available', function (done) {
|
it('emits an error on Windows when no update is available', function (done) {
|
||||||
if (process.platform !== 'win32') {
|
if (process.platform !== 'win32') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue