Files
atom/spec/update-spec.js
Daniel Hengeveld 1eaf30fae9 Add a few more things before stepping aside to work on another issue
…maybe rebase this away…
2016-03-01 15:06:33 -08:00

38 lines
1.2 KiB
JavaScript

'use babel'
import Update from '../src/update'
import remote from 'remote'
fdescribe('Update', () => {
describe('::initialize', () => {
it('subscribes to appropriate applicationDelegate events', () => {
const update = new Update()
update.initialize()
const downloadingSpy = jasmine.createSpy('downloadingSpy')
const checkingSpy = jasmine.createSpy('checkingSpy')
const noUpdateSpy = jasmine.createSpy('noUpdateSpy')
update.onDidBeginCheckingForUpdate(checkingSpy)
update.onDidBeginDownload(downloadingSpy)
update.onUpdateNotAvailable(noUpdateSpy)
const webContents = remote.getCurrentWebContents()
// AutoUpdateManager sends these from main process land
webContents.send('update-available', {releaseVersion: '1.2.3'})
webContents.send('did-begin-downloading-update')
webContents.send('checking-for-update')
webContents.send('update-not-available')
waitsFor(() => {
noUpdateSpy.callCount > 0
})
runs(() => {
expect(downloadingSpy.callCount).toBe(1)
expect(checkingSpy.callCount).toBe(1)
expect(noUpdateSpy.callCount).toBe(1)
})
})
})
})