chore: update to standard 12
This commit is contained in:
parent
9e85bdb02c
commit
558fff69e7
198 changed files with 4455 additions and 2940 deletions
|
@ -2,16 +2,16 @@
|
|||
|
||||
const assert = require('assert')
|
||||
const path = require('path')
|
||||
const {closeWindow} = require('./window-helpers')
|
||||
const { closeWindow } = require('./window-helpers')
|
||||
|
||||
const {remote} = require('electron')
|
||||
const { remote } = require('electron')
|
||||
|
||||
const comparePaths = (path1, path2) => {
|
||||
if (process.platform === 'win32') {
|
||||
path1 = path1.toLowerCase()
|
||||
path2 = path2.toLowerCase()
|
||||
}
|
||||
assert.equal(path1, path2)
|
||||
assert.strictEqual(path1, path2)
|
||||
}
|
||||
|
||||
describe('remote module', () => {
|
||||
|
@ -25,23 +25,23 @@ describe('remote module', () => {
|
|||
it('should returns same object for the same module', () => {
|
||||
const dialog1 = remote.require('electron')
|
||||
const dialog2 = remote.require('electron')
|
||||
assert.equal(dialog1, dialog2)
|
||||
assert.strictEqual(dialog1, dialog2)
|
||||
})
|
||||
|
||||
it('should work when object contains id property', () => {
|
||||
const a = remote.require(path.join(fixtures, 'module', 'id.js'))
|
||||
assert.equal(a.id, 1127)
|
||||
assert.strictEqual(a.id, 1127)
|
||||
})
|
||||
|
||||
it('should work when object has no prototype', () => {
|
||||
const a = remote.require(path.join(fixtures, 'module', 'no-prototype.js'))
|
||||
assert.equal(a.foo.constructor.name, '')
|
||||
assert.equal(a.foo.bar, 'baz')
|
||||
assert.equal(a.foo.baz, false)
|
||||
assert.equal(a.bar, 1234)
|
||||
assert.equal(a.anonymous.constructor.name, '')
|
||||
assert.equal(a.getConstructorName(Object.create(null)), '')
|
||||
assert.equal(a.getConstructorName(new (class {})()), '')
|
||||
assert.strictEqual(a.foo.constructor.name, '')
|
||||
assert.strictEqual(a.foo.bar, 'baz')
|
||||
assert.strictEqual(a.foo.baz, false)
|
||||
assert.strictEqual(a.bar, 1234)
|
||||
assert.strictEqual(a.anonymous.constructor.name, '')
|
||||
assert.strictEqual(a.getConstructorName(Object.create(null)), '')
|
||||
assert.strictEqual(a.getConstructorName(new (class {})()), '')
|
||||
})
|
||||
|
||||
it('should search module from the user app', () => {
|
||||
|
@ -51,41 +51,41 @@ describe('remote module', () => {
|
|||
|
||||
it('should work with function properties', () => {
|
||||
let a = remote.require(path.join(fixtures, 'module', 'export-function-with-properties.js'))
|
||||
assert.equal(typeof a, 'function')
|
||||
assert.equal(a.bar, 'baz')
|
||||
assert.strictEqual(typeof a, 'function')
|
||||
assert.strictEqual(a.bar, 'baz')
|
||||
|
||||
a = remote.require(path.join(fixtures, 'module', 'function-with-properties.js'))
|
||||
assert.equal(typeof a, 'object')
|
||||
assert.equal(a.foo(), 'hello')
|
||||
assert.equal(a.foo.bar, 'baz')
|
||||
assert.equal(a.foo.nested.prop, 'yes')
|
||||
assert.equal(a.foo.method1(), 'world')
|
||||
assert.equal(a.foo.method1.prop1(), 123)
|
||||
assert.strictEqual(typeof a, 'object')
|
||||
assert.strictEqual(a.foo(), 'hello')
|
||||
assert.strictEqual(a.foo.bar, 'baz')
|
||||
assert.strictEqual(a.foo.nested.prop, 'yes')
|
||||
assert.strictEqual(a.foo.method1(), 'world')
|
||||
assert.strictEqual(a.foo.method1.prop1(), 123)
|
||||
|
||||
assert.ok(Object.keys(a.foo).includes('bar'))
|
||||
assert.ok(Object.keys(a.foo).includes('nested'))
|
||||
assert.ok(Object.keys(a.foo).includes('method1'))
|
||||
|
||||
a = remote.require(path.join(fixtures, 'module', 'function-with-missing-properties.js')).setup()
|
||||
assert.equal(a.bar(), true)
|
||||
assert.equal(a.bar.baz, undefined)
|
||||
assert.strictEqual(a.bar(), true)
|
||||
assert.strictEqual(a.bar.baz, undefined)
|
||||
})
|
||||
|
||||
it('should work with static class members', () => {
|
||||
const a = remote.require(path.join(fixtures, 'module', 'remote-static.js'))
|
||||
assert.equal(typeof a.Foo, 'function')
|
||||
assert.equal(a.Foo.foo(), 3)
|
||||
assert.equal(a.Foo.bar, 'baz')
|
||||
assert.strictEqual(typeof a.Foo, 'function')
|
||||
assert.strictEqual(a.Foo.foo(), 3)
|
||||
assert.strictEqual(a.Foo.bar, 'baz')
|
||||
|
||||
const foo = new a.Foo()
|
||||
assert.equal(foo.baz(), 123)
|
||||
assert.strictEqual(foo.baz(), 123)
|
||||
})
|
||||
|
||||
it('includes the length of functions specified as arguments', () => {
|
||||
const a = remote.require(path.join(fixtures, 'module', 'function-with-args.js'))
|
||||
assert.equal(a((a, b, c, d, f) => {}), 5)
|
||||
assert.equal(a((a) => {}), 1)
|
||||
assert.equal(a((...args) => {}), 0)
|
||||
assert.strictEqual(a((a, b, c, d, f) => {}), 5)
|
||||
assert.strictEqual(a((a) => {}), 1)
|
||||
assert.strictEqual(a((...args) => {}), 0)
|
||||
})
|
||||
|
||||
it('handles circular references in arrays and objects', () => {
|
||||
|
@ -94,49 +94,49 @@ describe('remote module', () => {
|
|||
let arrayA = ['foo']
|
||||
const arrayB = [arrayA, 'bar']
|
||||
arrayA.push(arrayB)
|
||||
assert.deepEqual(a.returnArgs(arrayA, arrayB), [
|
||||
assert.deepStrictEqual(a.returnArgs(arrayA, arrayB), [
|
||||
['foo', [null, 'bar']],
|
||||
[['foo', null], 'bar']
|
||||
])
|
||||
|
||||
let objectA = {foo: 'bar'}
|
||||
const objectB = {baz: objectA}
|
||||
let objectA = { foo: 'bar' }
|
||||
const objectB = { baz: objectA }
|
||||
objectA.objectB = objectB
|
||||
assert.deepEqual(a.returnArgs(objectA, objectB), [
|
||||
{foo: 'bar', objectB: {baz: null}},
|
||||
{baz: {foo: 'bar', objectB: null}}
|
||||
assert.deepStrictEqual(a.returnArgs(objectA, objectB), [
|
||||
{ foo: 'bar', objectB: { baz: null } },
|
||||
{ baz: { foo: 'bar', objectB: null } }
|
||||
])
|
||||
|
||||
arrayA = [1, 2, 3]
|
||||
assert.deepEqual(a.returnArgs({foo: arrayA}, {bar: arrayA}), [
|
||||
{foo: [1, 2, 3]},
|
||||
{bar: [1, 2, 3]}
|
||||
assert.deepStrictEqual(a.returnArgs({ foo: arrayA }, { bar: arrayA }), [
|
||||
{ foo: [1, 2, 3] },
|
||||
{ bar: [1, 2, 3] }
|
||||
])
|
||||
|
||||
objectA = {foo: 'bar'}
|
||||
assert.deepEqual(a.returnArgs({foo: objectA}, {bar: objectA}), [
|
||||
{foo: {foo: 'bar'}},
|
||||
{bar: {foo: 'bar'}}
|
||||
objectA = { foo: 'bar' }
|
||||
assert.deepStrictEqual(a.returnArgs({ foo: objectA }, { bar: objectA }), [
|
||||
{ foo: { foo: 'bar' } },
|
||||
{ bar: { foo: 'bar' } }
|
||||
])
|
||||
|
||||
arrayA = []
|
||||
arrayA.push(arrayA)
|
||||
assert.deepEqual(a.returnArgs(arrayA), [
|
||||
assert.deepStrictEqual(a.returnArgs(arrayA), [
|
||||
[null]
|
||||
])
|
||||
|
||||
objectA = {}
|
||||
objectA.foo = objectA
|
||||
objectA.bar = 'baz'
|
||||
assert.deepEqual(a.returnArgs(objectA), [
|
||||
{foo: null, bar: 'baz'}
|
||||
assert.deepStrictEqual(a.returnArgs(objectA), [
|
||||
{ foo: null, bar: 'baz' }
|
||||
])
|
||||
|
||||
objectA = {}
|
||||
objectA.foo = {bar: objectA}
|
||||
objectA.foo = { bar: objectA }
|
||||
objectA.bar = 'baz'
|
||||
assert.deepEqual(a.returnArgs(objectA), [
|
||||
{foo: {bar: null}, bar: 'baz'}
|
||||
assert.deepStrictEqual(a.returnArgs(objectA), [
|
||||
{ foo: { bar: null }, bar: 'baz' }
|
||||
])
|
||||
})
|
||||
})
|
||||
|
@ -146,46 +146,46 @@ describe('remote module', () => {
|
|||
const buf = Buffer.from('test')
|
||||
const call = remote.require(path.join(fixtures, 'module', 'call.js'))
|
||||
const result = call.call(remote.createFunctionWithReturnValue(buf))
|
||||
assert.equal(result.constructor.name, 'Buffer')
|
||||
assert.strictEqual(result.constructor.name, 'Buffer')
|
||||
})
|
||||
})
|
||||
|
||||
describe('remote modules', () => {
|
||||
it('includes browser process modules as properties', () => {
|
||||
assert.equal(typeof remote.app.getPath, 'function')
|
||||
assert.equal(typeof remote.webContents.getFocusedWebContents, 'function')
|
||||
assert.equal(typeof remote.clipboard.readText, 'function')
|
||||
assert.equal(typeof remote.shell.openExternal, 'function')
|
||||
assert.strictEqual(typeof remote.app.getPath, 'function')
|
||||
assert.strictEqual(typeof remote.webContents.getFocusedWebContents, 'function')
|
||||
assert.strictEqual(typeof remote.clipboard.readText, 'function')
|
||||
assert.strictEqual(typeof remote.shell.openExternal, 'function')
|
||||
})
|
||||
|
||||
it('returns toString() of original function via toString()', () => {
|
||||
const {readText} = remote.clipboard
|
||||
const { readText } = remote.clipboard
|
||||
assert(readText.toString().startsWith('function'))
|
||||
|
||||
const {functionWithToStringProperty} = remote.require(path.join(fixtures, 'module', 'to-string-non-function.js'))
|
||||
assert.equal(functionWithToStringProperty.toString, 'hello')
|
||||
const { functionWithToStringProperty } = remote.require(path.join(fixtures, 'module', 'to-string-non-function.js'))
|
||||
assert.strictEqual(functionWithToStringProperty.toString, 'hello')
|
||||
})
|
||||
})
|
||||
|
||||
describe('remote object in renderer', () => {
|
||||
it('can change its properties', () => {
|
||||
const property = remote.require(path.join(fixtures, 'module', 'property.js'))
|
||||
assert.equal(property.property, 1127)
|
||||
assert.strictEqual(property.property, 1127)
|
||||
|
||||
property.property = null
|
||||
assert.equal(property.property, null)
|
||||
assert.strictEqual(property.property, null)
|
||||
property.property = undefined
|
||||
assert.equal(property.property, undefined)
|
||||
assert.strictEqual(property.property, undefined)
|
||||
property.property = 1007
|
||||
assert.equal(property.property, 1007)
|
||||
assert.strictEqual(property.property, 1007)
|
||||
|
||||
assert.equal(property.getFunctionProperty(), 'foo-browser')
|
||||
assert.strictEqual(property.getFunctionProperty(), 'foo-browser')
|
||||
property.func.property = 'bar'
|
||||
assert.equal(property.getFunctionProperty(), 'bar-browser')
|
||||
property.func.property = 'foo' // revert back
|
||||
assert.strictEqual(property.getFunctionProperty(), 'bar-browser')
|
||||
property.func.property = 'foo' // revert back
|
||||
|
||||
const property2 = remote.require(path.join(fixtures, 'module', 'property.js'))
|
||||
assert.equal(property2.property, 1007)
|
||||
assert.strictEqual(property2.property, 1007)
|
||||
property.property = 1127
|
||||
})
|
||||
|
||||
|
@ -213,17 +213,17 @@ describe('remote module', () => {
|
|||
it('can construct an object from its member', () => {
|
||||
const call = remote.require(path.join(fixtures, 'module', 'call.js'))
|
||||
const obj = new call.constructor()
|
||||
assert.equal(obj.test, 'test')
|
||||
assert.strictEqual(obj.test, 'test')
|
||||
})
|
||||
|
||||
it('can reassign and delete its member functions', () => {
|
||||
const remoteFunctions = remote.require(path.join(fixtures, 'module', 'function.js'))
|
||||
assert.equal(remoteFunctions.aFunction(), 1127)
|
||||
assert.strictEqual(remoteFunctions.aFunction(), 1127)
|
||||
|
||||
remoteFunctions.aFunction = () => { return 1234 }
|
||||
assert.equal(remoteFunctions.aFunction(), 1234)
|
||||
assert.strictEqual(remoteFunctions.aFunction(), 1234)
|
||||
|
||||
assert.equal(delete remoteFunctions.aFunction, true)
|
||||
assert.strictEqual(delete remoteFunctions.aFunction, true)
|
||||
})
|
||||
|
||||
it('is referenced by its members', () => {
|
||||
|
@ -249,20 +249,20 @@ describe('remote module', () => {
|
|||
|
||||
it('keeps its constructor name for objects', () => {
|
||||
const buf = Buffer.from('test')
|
||||
assert.equal(printName.print(buf), 'Buffer')
|
||||
assert.strictEqual(printName.print(buf), 'Buffer')
|
||||
})
|
||||
|
||||
it('supports instanceof Date', () => {
|
||||
const now = new Date()
|
||||
assert.equal(printName.print(now), 'Date')
|
||||
assert.deepEqual(printName.echo(now), now)
|
||||
assert.strictEqual(printName.print(now), 'Date')
|
||||
assert.deepStrictEqual(printName.echo(now), now)
|
||||
})
|
||||
|
||||
it('supports instanceof Buffer', () => {
|
||||
const buffer = Buffer.from('test')
|
||||
assert.ok(buffer.equals(printName.echo(buffer)))
|
||||
|
||||
const objectWithBuffer = {a: 'foo', b: Buffer.from('bar')}
|
||||
const objectWithBuffer = { a: 'foo', b: Buffer.from('bar') }
|
||||
assert.ok(objectWithBuffer.b.equals(printName.echo(objectWithBuffer).b))
|
||||
|
||||
const arrayWithBuffer = [1, 2, Buffer.from('baz')]
|
||||
|
@ -274,89 +274,89 @@ describe('remote module', () => {
|
|||
const view = new DataView(buffer)
|
||||
|
||||
view.setFloat64(0, Math.PI)
|
||||
assert.deepEqual(printName.echo(buffer), buffer)
|
||||
assert.equal(printName.print(buffer), 'ArrayBuffer')
|
||||
assert.deepStrictEqual(printName.echo(buffer), buffer)
|
||||
assert.strictEqual(printName.print(buffer), 'ArrayBuffer')
|
||||
})
|
||||
|
||||
it('supports instanceof Int8Array', () => {
|
||||
const values = [1, 2, 3, 4]
|
||||
assert.deepEqual(printName.typedArray('Int8Array', values), values)
|
||||
assert.deepStrictEqual(printName.typedArray('Int8Array', values), values)
|
||||
|
||||
const int8values = new Int8Array(values)
|
||||
assert.deepEqual(printName.typedArray('Int8Array', int8values), int8values)
|
||||
assert.equal(printName.print(int8values), 'Int8Array')
|
||||
assert.deepStrictEqual(printName.typedArray('Int8Array', int8values), int8values)
|
||||
assert.strictEqual(printName.print(int8values), 'Int8Array')
|
||||
})
|
||||
|
||||
it('supports instanceof Uint8Array', () => {
|
||||
const values = [1, 2, 3, 4]
|
||||
assert.deepEqual(printName.typedArray('Uint8Array', values), values)
|
||||
assert.deepStrictEqual(printName.typedArray('Uint8Array', values), values)
|
||||
|
||||
const uint8values = new Uint8Array(values)
|
||||
assert.deepEqual(printName.typedArray('Uint8Array', uint8values), uint8values)
|
||||
assert.equal(printName.print(uint8values), 'Uint8Array')
|
||||
assert.deepStrictEqual(printName.typedArray('Uint8Array', uint8values), uint8values)
|
||||
assert.strictEqual(printName.print(uint8values), 'Uint8Array')
|
||||
})
|
||||
|
||||
it('supports instanceof Uint8ClampedArray', () => {
|
||||
const values = [1, 2, 3, 4]
|
||||
assert.deepEqual(printName.typedArray('Uint8ClampedArray', values), values)
|
||||
assert.deepStrictEqual(printName.typedArray('Uint8ClampedArray', values), values)
|
||||
|
||||
const uint8values = new Uint8ClampedArray(values)
|
||||
assert.deepEqual(printName.typedArray('Uint8ClampedArray', uint8values), uint8values)
|
||||
assert.equal(printName.print(uint8values), 'Uint8ClampedArray')
|
||||
assert.deepStrictEqual(printName.typedArray('Uint8ClampedArray', uint8values), uint8values)
|
||||
assert.strictEqual(printName.print(uint8values), 'Uint8ClampedArray')
|
||||
})
|
||||
|
||||
it('supports instanceof Int16Array', () => {
|
||||
const values = [0x1234, 0x2345, 0x3456, 0x4567]
|
||||
assert.deepEqual(printName.typedArray('Int16Array', values), values)
|
||||
assert.deepStrictEqual(printName.typedArray('Int16Array', values), values)
|
||||
|
||||
const int16values = new Int16Array(values)
|
||||
assert.deepEqual(printName.typedArray('Int16Array', int16values), int16values)
|
||||
assert.equal(printName.print(int16values), 'Int16Array')
|
||||
assert.deepStrictEqual(printName.typedArray('Int16Array', int16values), int16values)
|
||||
assert.strictEqual(printName.print(int16values), 'Int16Array')
|
||||
})
|
||||
|
||||
it('supports instanceof Uint16Array', () => {
|
||||
const values = [0x1234, 0x2345, 0x3456, 0x4567]
|
||||
assert.deepEqual(printName.typedArray('Uint16Array', values), values)
|
||||
assert.deepStrictEqual(printName.typedArray('Uint16Array', values), values)
|
||||
|
||||
const uint16values = new Uint16Array(values)
|
||||
assert.deepEqual(printName.typedArray('Uint16Array', uint16values), uint16values)
|
||||
assert.equal(printName.print(uint16values), 'Uint16Array')
|
||||
assert.deepStrictEqual(printName.typedArray('Uint16Array', uint16values), uint16values)
|
||||
assert.strictEqual(printName.print(uint16values), 'Uint16Array')
|
||||
})
|
||||
|
||||
it('supports instanceof Int32Array', () => {
|
||||
const values = [0x12345678, 0x23456789]
|
||||
assert.deepEqual(printName.typedArray('Int32Array', values), values)
|
||||
assert.deepStrictEqual(printName.typedArray('Int32Array', values), values)
|
||||
|
||||
const int32values = new Int32Array(values)
|
||||
assert.deepEqual(printName.typedArray('Int32Array', int32values), int32values)
|
||||
assert.equal(printName.print(int32values), 'Int32Array')
|
||||
assert.deepStrictEqual(printName.typedArray('Int32Array', int32values), int32values)
|
||||
assert.strictEqual(printName.print(int32values), 'Int32Array')
|
||||
})
|
||||
|
||||
it('supports instanceof Uint32Array', () => {
|
||||
const values = [0x12345678, 0x23456789]
|
||||
assert.deepEqual(printName.typedArray('Uint32Array', values), values)
|
||||
assert.deepStrictEqual(printName.typedArray('Uint32Array', values), values)
|
||||
|
||||
const uint32values = new Uint32Array(values)
|
||||
assert.deepEqual(printName.typedArray('Uint32Array', uint32values), uint32values)
|
||||
assert.equal(printName.print(uint32values), 'Uint32Array')
|
||||
assert.deepStrictEqual(printName.typedArray('Uint32Array', uint32values), uint32values)
|
||||
assert.strictEqual(printName.print(uint32values), 'Uint32Array')
|
||||
})
|
||||
|
||||
it('supports instanceof Float32Array', () => {
|
||||
const values = [0.5, 1.0, 1.5]
|
||||
assert.deepEqual(printName.typedArray('Float32Array', values), values)
|
||||
assert.deepStrictEqual(printName.typedArray('Float32Array', values), values)
|
||||
|
||||
const float32values = new Float32Array()
|
||||
assert.deepEqual(printName.typedArray('Float32Array', float32values), float32values)
|
||||
assert.equal(printName.print(float32values), 'Float32Array')
|
||||
assert.deepStrictEqual(printName.typedArray('Float32Array', float32values), float32values)
|
||||
assert.strictEqual(printName.print(float32values), 'Float32Array')
|
||||
})
|
||||
|
||||
it('supports instanceof Float64Array', () => {
|
||||
const values = [0.5, 1.0, 1.5]
|
||||
assert.deepEqual(printName.typedArray('Float64Array', values), values)
|
||||
assert.deepStrictEqual(printName.typedArray('Float64Array', values), values)
|
||||
|
||||
const float64values = new Float64Array([0.5, 1.0, 1.5])
|
||||
assert.deepEqual(printName.typedArray('Float64Array', float64values), float64values)
|
||||
assert.equal(printName.print(float64values), 'Float64Array')
|
||||
assert.deepStrictEqual(printName.typedArray('Float64Array', float64values), float64values)
|
||||
assert.strictEqual(printName.print(float64values), 'Float64Array')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -364,7 +364,7 @@ describe('remote module', () => {
|
|||
it('can be used as promise in each side', (done) => {
|
||||
const promise = remote.require(path.join(fixtures, 'module', 'promise.js'))
|
||||
promise.twicePromise(Promise.resolve(1234)).then((value) => {
|
||||
assert.equal(value, 2468)
|
||||
assert.strictEqual(value, 2468)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -372,7 +372,7 @@ describe('remote module', () => {
|
|||
it('handles rejections via catch(onRejected)', (done) => {
|
||||
const promise = remote.require(path.join(fixtures, 'module', 'rejected-promise.js'))
|
||||
promise.reject(Promise.resolve(1234)).catch((error) => {
|
||||
assert.equal(error.message, 'rejected')
|
||||
assert.strictEqual(error.message, 'rejected')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -380,7 +380,7 @@ describe('remote module', () => {
|
|||
it('handles rejections via then(onFulfilled, onRejected)', (done) => {
|
||||
const promise = remote.require(path.join(fixtures, 'module', 'rejected-promise.js'))
|
||||
promise.reject(Promise.resolve(1234)).then(() => {}, (error) => {
|
||||
assert.equal(error.message, 'rejected')
|
||||
assert.strictEqual(error.message, 'rejected')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -394,7 +394,7 @@ describe('remote module', () => {
|
|||
promise.reject().then(() => {
|
||||
done(new Error('Promise was not rejected'))
|
||||
}).catch((error) => {
|
||||
assert.equal(error.message, 'rejected')
|
||||
assert.strictEqual(error.message, 'rejected')
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
@ -402,7 +402,7 @@ describe('remote module', () => {
|
|||
it('emits unhandled rejection events in the renderer process', (done) => {
|
||||
window.addEventListener('unhandledrejection', function (event) {
|
||||
event.preventDefault()
|
||||
assert.equal(event.reason.message, 'rejected')
|
||||
assert.strictEqual(event.reason.message, 'rejected')
|
||||
done()
|
||||
})
|
||||
|
||||
|
@ -427,17 +427,17 @@ describe('remote module', () => {
|
|||
let derived = cl.derived
|
||||
|
||||
it('can get methods', () => {
|
||||
assert.equal(base.method(), 'method')
|
||||
assert.strictEqual(base.method(), 'method')
|
||||
})
|
||||
|
||||
it('can get properties', () => {
|
||||
assert.equal(base.readonly, 'readonly')
|
||||
assert.strictEqual(base.readonly, 'readonly')
|
||||
})
|
||||
|
||||
it('can change properties', () => {
|
||||
assert.equal(base.value, 'old')
|
||||
assert.strictEqual(base.value, 'old')
|
||||
base.value = 'new'
|
||||
assert.equal(base.value, 'new')
|
||||
assert.strictEqual(base.value, 'new')
|
||||
base.value = 'old'
|
||||
})
|
||||
|
||||
|
@ -447,8 +447,8 @@ describe('remote module', () => {
|
|||
})
|
||||
|
||||
it('keeps prototype chain in derived class', () => {
|
||||
assert.equal(derived.method(), 'method')
|
||||
assert.equal(derived.readonly, 'readonly')
|
||||
assert.strictEqual(derived.method(), 'method')
|
||||
assert.strictEqual(derived.readonly, 'readonly')
|
||||
assert(!derived.hasOwnProperty('method'))
|
||||
let proto = Object.getPrototypeOf(derived)
|
||||
assert(!proto.hasOwnProperty('method'))
|
||||
|
@ -459,7 +459,7 @@ describe('remote module', () => {
|
|||
let method = derived.method
|
||||
derived = null
|
||||
global.gc()
|
||||
assert.equal(method(), 'method')
|
||||
assert.strictEqual(method(), 'method')
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -480,7 +480,7 @@ describe('remote module', () => {
|
|||
throwFunction(err)
|
||||
} catch (error) {
|
||||
assert.ok(error.from)
|
||||
assert.deepEqual(error.cause, err)
|
||||
assert.deepStrictEqual(error.cause, err)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue