test: move remote specs to main process (#21387)

This commit is contained in:
Jeremy Apthorp 2019-12-09 10:27:30 -08:00 committed by GitHub
parent 409ef49d3a
commit 7f6b308bf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 702 additions and 633 deletions

View file

@ -0,0 +1,7 @@
exports.call = function (func) {
return func()
}
exports.constructor = function () {
this.test = 'test'
}

View file

@ -0,0 +1,3 @@
exports.returnArgs = function (...args) {
return args
}

View file

@ -0,0 +1,29 @@
'use strict'
let value = 'old'
class BaseClass {
method () {
return 'method'
}
get readonly () {
return 'readonly'
}
get value () {
return value
}
set value (val) {
value = val
}
}
class DerivedClass extends BaseClass {
}
module.exports = {
base: new BaseClass(),
derived: new DerivedClass()
}

View file

@ -0,0 +1,11 @@
class Foo {
set bar (value) {
throw new Error('setting error')
}
get bar () {
throw new Error('getting error')
}
}
module.exports = new Foo()

View file

@ -0,0 +1,3 @@
module.exports = function (error) {
throw error
}

View file

@ -0,0 +1,4 @@
function foo () {}
foo.bar = 'baz'
module.exports = foo

View file

@ -0,0 +1,3 @@
module.exports = function (cb) {
return cb.length
}

View file

@ -0,0 +1,13 @@
exports.setup = function () {
const foo = {}
foo.bar = function () {
return delete foo.bar.baz && delete foo.bar
}
foo.bar.baz = function () {
return 3
}
return foo
}

View file

@ -0,0 +1,17 @@
function foo () {
return 'hello'
}
foo.bar = 'baz'
foo.nested = {
prop: 'yes'
}
foo.method1 = function () {
return 'world'
}
foo.method1.prop1 = function () {
return 123
}
module.exports = {
foo: foo
}

View file

@ -0,0 +1 @@
exports.aFunction = function () { return 1127 }

View file

@ -0,0 +1 @@
exports.id = 1127

View file

@ -0,0 +1,11 @@
const foo = Object.create(null)
foo.bar = 'baz'
foo.baz = false
module.exports = {
foo: foo,
bar: 1234,
anonymous: new (class {})(),
getConstructorName: function (value) {
return value.constructor.name
}
}

View file

@ -0,0 +1,5 @@
exports.twicePromise = function (promise) {
return promise.then(function (value) {
return value * 2
})
}

View file

@ -0,0 +1,11 @@
exports.property = 1127
function func () {
}
func.property = 'foo'
exports.func = func
exports.getFunctionProperty = () => {
return `${func.property}-${process.type}`
}

View file

@ -0,0 +1,5 @@
exports.reject = function (promise) {
return promise.then(function () {
throw Error('rejected')
})
}

View file

@ -0,0 +1,11 @@
const { BrowserWindow } = require('electron')
class Foo {
set bar (value) {
if (!(value instanceof BrowserWindow)) {
throw new Error('setting error')
}
}
}
module.exports = new Foo()

View file

@ -0,0 +1,15 @@
class Foo {
static foo () {
return 3
}
baz () {
return 123
}
}
Foo.bar = 'baz'
module.exports = {
Foo: Foo
}

View file

@ -0,0 +1,4 @@
function hello () {
}
hello.toString = 'hello'
module.exports = { functionWithToStringProperty: hello }

View file

@ -0,0 +1,3 @@
exports.reject = function () {
return Promise.reject(new Error('rejected'))
}