Start fixing tests

This commit is contained in:
Antonio Scandurra 2017-03-11 19:05:28 +01:00
parent fbcbfc4889
commit 284f2c62e5
7 changed files with 25 additions and 14 deletions

View File

@ -340,7 +340,8 @@ describe "AtomEnvironment", ->
it "saves the BlobStore so it can be loaded after reload", ->
configDirPath = temp.mkdirSync('atom-spec-environment')
fakeBlobStore = jasmine.createSpyObj("blob store", ["save"])
atomEnvironment = new AtomEnvironment({applicationDelegate: atom.applicationDelegate, enablePersistence: true, configDirPath, blobStore: fakeBlobStore, window, document})
atomEnvironment = new AtomEnvironment({applicationDelegate: atom.applicationDelegate, enablePersistence: true})
atomEnvironment.initialize({configDirPath, blobStore: fakeBlobStore, window, document})
atomEnvironment.unloadEditorWindow()
@ -357,7 +358,8 @@ describe "AtomEnvironment", ->
head: document.createElement('head')
body: document.createElement('body')
}
atomEnvironment = new AtomEnvironment({applicationDelegate: atom.applicationDelegate, window, document: fakeDocument})
atomEnvironment = new AtomEnvironment({applicationDelegate: atom.applicationDelegate})
atomEnvironment.initialize({window, document: fakeDocument})
spyOn(atomEnvironment.packages, 'getAvailablePackagePaths').andReturn []
spyOn(atomEnvironment, 'displayWindow').andReturn Promise.resolve()
atomEnvironment.startEditorWindow()

View File

@ -11,9 +11,8 @@ describe('AutoUpdateManager (renderer)', () => {
let autoUpdateManager
beforeEach(() => {
autoUpdateManager = new AutoUpdateManager({
applicationDelegate: atom.applicationDelegate
})
autoUpdateManager = new AutoUpdateManager({applicationDelegate: atom.applicationDelegate})
autoUpdateManager.initialize()
})
afterEach(() => {

View File

@ -25,7 +25,8 @@ describe "CommandInstaller on #darwin", ->
it "shows an error dialog when installing commands interactively fails", ->
appDelegate = jasmine.createSpyObj("appDelegate", ["confirm"])
installer = new CommandInstaller("2.0.2", appDelegate)
installer = new CommandInstaller(appDelegate)
installer.initialize("2.0.2")
spyOn(installer, "installAtomCommand").andCallFake (__, callback) -> callback(new Error("an error"))
installer.installShellCommandsInteractively()
@ -48,7 +49,8 @@ describe "CommandInstaller on #darwin", ->
it "shows a success dialog when installing commands interactively succeeds", ->
appDelegate = jasmine.createSpyObj("appDelegate", ["confirm"])
installer = new CommandInstaller("2.0.2", appDelegate)
installer = new CommandInstaller(appDelegate)
installer.initialize("2.0.2")
spyOn(installer, "installAtomCommand").andCallFake (__, callback) -> callback()
spyOn(installer, "installApmCommand").andCallFake (__, callback) -> callback()
@ -61,7 +63,8 @@ describe "CommandInstaller on #darwin", ->
describe "when using a stable version of atom", ->
beforeEach ->
installer = new CommandInstaller("2.0.2")
installer = new CommandInstaller()
installer.initialize("2.0.2")
it "symlinks the atom command as 'atom'", ->
installedAtomPath = path.join(installationPath, 'atom')
@ -91,7 +94,8 @@ describe "CommandInstaller on #darwin", ->
describe "when using a beta version of atom", ->
beforeEach ->
installer = new CommandInstaller("2.2.0-beta.0")
installer = new CommandInstaller()
installer.initialize("2.2.0-beta.0")
it "symlinks the atom command as 'atom-beta'", ->
installedAtomPath = path.join(installationPath, 'atom-beta')

View File

@ -5,7 +5,8 @@ describe "ContextMenuManager", ->
beforeEach ->
{resourcePath} = atom.getLoadSettings()
contextMenu = new ContextMenuManager({resourcePath, keymapManager: atom.keymaps})
contextMenu = new ContextMenuManager({keymapManager: atom.keymaps})
contextMenu.initialize({resourcePath})
parent = document.createElement("div")
child = document.createElement("div")

View File

@ -30,7 +30,8 @@ describe("HistoryManager", () => {
return projectDisposable
})
historyManager = new HistoryManager({stateStore, localStorage: window.localStorage, project, commands: commandRegistry})
historyManager = new HistoryManager({stateStore, project, commands: commandRegistry})
historyManager.initialize({localStorage: window.localStorage})
await historyManager.loadState()
})

View File

@ -56,14 +56,16 @@ export default async function () {
TextEditor.setClipboard(clipboard)
const applicationDelegate = new ApplicationDelegate()
global.atom = new AtomEnvironment({
const environmentParams = {
applicationDelegate,
window,
document,
clipboard,
configDirPath: process.env.ATOM_HOME,
enablePersistence: false
})
}
global.atom = new AtomEnvironment(environmentParams)
global.atom.initialize(environmentParams)
// Prevent benchmarks from modifying application menus
global.atom.menu.sendToBrowserProcess = function () { }

View File

@ -79,7 +79,9 @@ module.exports = ({blobStore}) ->
params.clipboard = clipboard unless params.hasOwnProperty("clipboard")
params.blobStore = blobStore unless params.hasOwnProperty("blobStore")
params.onlyLoadBaseStyleSheets = true unless params.hasOwnProperty("onlyLoadBaseStyleSheets")
new AtomEnvironment(params)
atomEnvironment = new AtomEnvironment(params)
atomEnvironment.initialize(params)
atomEnvironment
promise = testRunner({
logFile, headless, testPaths, buildAtomEnvironment, buildDefaultApplicationDelegate, legacyTestRunner