mirror of
https://github.com/atom/atom.git
synced 2026-02-18 10:31:54 -05:00
38 lines
1.2 KiB
JavaScript
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)
|
|
})
|
|
})
|
|
})
|
|
})
|