Move require spec to api-app-spec

This commit is contained in:
Kevin Sawicki 2016-05-23 13:12:02 -07:00
parent 4a41311409
commit 5e2f36387f
2 changed files with 32 additions and 33 deletions

View file

@ -3,10 +3,9 @@ const ChildProcess = require('child_process')
const https = require('https') const https = require('https')
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const remote = require('electron').remote const {remote} = require('electron')
const app = remote.require('electron').app const {app, BrowserWindow, ipcMain} = remote
const BrowserWindow = remote.require('electron').BrowserWindow
const isCI = remote.getGlobal('isCi') const isCI = remote.getGlobal('isCi')
describe('electron module', function () { describe('electron module', function () {
@ -15,6 +14,36 @@ describe('electron module', function () {
require('clipboard') require('clipboard')
}, /Cannot find module 'clipboard'/) }, /Cannot find module 'clipboard'/)
}) })
describe('require("electron")', function () {
let window = null
beforeEach(function () {
if (window != null) {
window.destroy()
}
window = new BrowserWindow({
show: false,
width: 400,
height: 400
})
})
afterEach(function () {
if (window != null) {
window.destroy()
}
window = null
})
it('always returns the internal electron module', function (done) {
ipcMain.once('answer', function () {
done()
})
window.loadURL('file://' + path.join(__dirname, 'fixtures', 'api', 'electron-module-app', 'index.html'))
})
})
}) })
describe('app module', function () { describe('app module', function () {

View file

@ -4,7 +4,6 @@ const fs = require('fs')
const path = require('path') const path = require('path')
const os = require('os') const os = require('os')
const {remote} = require('electron') const {remote} = require('electron')
const {BrowserWindow, ipcMain} = remote
describe('node feature', function () { describe('node feature', function () {
var fixtures = path.join(__dirname, 'fixtures') var fixtures = path.join(__dirname, 'fixtures')
@ -229,33 +228,4 @@ describe('node feature', function () {
require('vm').runInNewContext('') require('vm').runInNewContext('')
}) })
}) })
describe('require("electron")', function () {
let window = null
beforeEach(function () {
if (window != null) {
window.destroy()
}
window = new BrowserWindow({
show: false,
width: 400,
height: 400
})
})
afterEach(function () {
if (window != null) {
window.destroy()
}
window = null
})
it('always returns the internal electron module', function (done) {
ipcMain.once('answer', function () {
done()
})
window.loadURL('file://' + path.join(__dirname, 'fixtures', 'api', 'electron-module-app', 'index.html'))
})
})
}) })