Rename Update AutoUpdateManager

This commit is contained in:
Ben Ogle
2016-02-23 17:07:11 -08:00
parent dd53c6f856
commit 342f72b6a1
3 changed files with 15 additions and 16 deletions

View File

@@ -1,25 +1,25 @@
'use babel'
import Update from '../src/update'
import AutoUpdateManager from '../src/auto-update-manager'
import {remote} from 'electron'
const electronAutoUpdater = remote.require('electron').autoUpdater
describe('Update', () => {
let update
fdescribe('AutoUpdateManager (renderer)', () => {
let autoUpdateManager
beforeEach(() => {
update = new Update()
update.initialize()
autoUpdateManager = new AutoUpdateManager()
autoUpdateManager.initialize()
})
afterEach(() => {
update.dispose()
autoUpdateManager.dispose()
})
describe('::onDidBeginCheckingForUpdate', () => {
it('subscribes to "did-begin-checking-for-update" event', () => {
const spy = jasmine.createSpy('spy')
update.onDidBeginCheckingForUpdate(spy)
autoUpdateManager.onDidBeginCheckingForUpdate(spy)
electronAutoUpdater.emit('checking-for-update')
waitsFor(() => {
return spy.callCount === 1
@@ -30,7 +30,7 @@ describe('Update', () => {
describe('::onDidBeginDownload', () => {
it('subscribes to "did-begin-downloading-update" event', () => {
const spy = jasmine.createSpy('spy')
update.onDidBeginDownload(spy)
autoUpdateManager.onDidBeginDownload(spy)
electronAutoUpdater.emit('update-available')
waitsFor(() => {
return spy.callCount === 1
@@ -41,7 +41,7 @@ describe('Update', () => {
describe('::onDidCompleteDownload', () => {
it('subscribes to "did-complete-downloading-update" event', () => {
const spy = jasmine.createSpy('spy')
update.onDidCompleteDownload(spy)
autoUpdateManager.onDidCompleteDownload(spy)
electronAutoUpdater.emit('update-downloaded', null, null, {releaseVersion: '1.2.3'})
waitsFor(() => {
return spy.callCount === 1
@@ -52,12 +52,11 @@ describe('Update', () => {
describe('::onUpdateNotAvailable', () => {
it('subscribes to "update-not-available" event', () => {
const spy = jasmine.createSpy('spy')
update.onUpdateNotAvailable(spy)
autoUpdateManager.onUpdateNotAvailable(spy)
electronAutoUpdater.emit('update-not-available')
waitsFor(() => {
return spy.callCount === 1
})
})
})
})

View File

@@ -41,7 +41,7 @@ TextEditor = require './text-editor'
TextBuffer = require 'text-buffer'
Gutter = require './gutter'
TextEditorRegistry = require './text-editor-registry'
Update = require './update'
AutoUpdateManager = require './auto-update-manager'
WorkspaceElement = require './workspace-element'
PanelContainerElement = require './panel-container-element'
@@ -116,8 +116,8 @@ class AtomEnvironment extends Model
# Public: A {TextEditorRegistry} instance
textEditors: null
# Public: An {Update} instance
update: null
# Public: An {AutoUpdateManager} instance
autoUpdater: null
saveStateDebounceInterval: 1000
@@ -192,7 +192,7 @@ class AtomEnvironment extends Model
@themes.workspace = @workspace
@textEditors = new TextEditorRegistry
@update = new Update()
@autoUpdater = new AutoUpdateManager
@config.load()

View File

@@ -3,7 +3,7 @@
import {Emitter, CompositeDisposable} from 'event-kit'
import {ipcRenderer} from 'electron'
export default class Update {
export default class AutoUpdateManager {
constructor () {
this.subscriptions = new CompositeDisposable()
this.emitter = new Emitter()