chore: move remote module fixtures for easier deletion when removed (#25736)

This commit is contained in:
Milan Burda 2020-10-05 03:22:35 +02:00 committed by GitHub
parent 485adae94c
commit 508b8d902b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 38 additions and 40 deletions

View file

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

View file

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

View file

@ -1,29 +0,0 @@
'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

@ -1,13 +0,0 @@
const path = require('path');
const { remote } = require('electron');
const { Buffer } = window;
delete window.Buffer;
delete global.Buffer;
// Test that remote.js doesn't use Buffer global
if (remote) {
remote.require(path.join(__dirname, 'print_name.js')).echo(Buffer.from('bar'));
}
window.test = Buffer.from('buffer');

View file

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

View file

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

View file

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

View file

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

View file

@ -1,13 +0,0 @@
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

@ -1,17 +0,0 @@
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

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

View file

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

View file

@ -1,11 +0,0 @@
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

@ -1,5 +0,0 @@
const { remote, ipcRenderer } = require('electron');
remote.getCurrentWindow().rendererFunc = () => {
ipcRenderer.send('done');
};
remote.getCurrentWindow().rendererFunc();

View file

@ -1,5 +0,0 @@
const { ipcRenderer, remote } = require('electron');
window.onload = function () {
ipcRenderer.send('remote', typeof remote);
};

View file

@ -1,36 +0,0 @@
exports.print = function (obj) {
return obj.constructor.name;
};
exports.echo = function (obj) {
return obj;
};
const typedArrays = {
Int8Array,
Uint8Array,
Uint8ClampedArray,
Int16Array,
Uint16Array,
Int32Array,
Uint32Array,
Float32Array,
Float64Array
};
exports.typedArray = function (type, values) {
const constructor = typedArrays[type];
const array = new constructor(values.length);
for (let i = 0; i < values.length; ++i) {
array[i] = values[i];
}
return array;
};
exports.getNaN = function () {
return NaN;
};
exports.getInfinity = function () {
return Infinity;
};

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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