refactor: take advantage of structured clone algorithm in the remote module (#20427)

This commit is contained in:
Milan Burda 2019-10-10 15:59:08 +02:00 committed by John Kleinschmidt
parent c2e77e4429
commit b92163d226
13 changed files with 87 additions and 210 deletions

View file

@ -256,12 +256,36 @@ ifdescribe(features.isRemoteModuleEnabled())('remote module', () => {
expect(printName.print(buf)).to.equal('Buffer')
})
it('supports instanceof Boolean', () => {
const obj = Boolean(true)
expect(printName.print(obj)).to.equal('Boolean')
expect(printName.echo(obj)).to.deep.equal(obj)
})
it('supports instanceof Number', () => {
const obj = Number(42)
expect(printName.print(obj)).to.equal('Number')
expect(printName.echo(obj)).to.deep.equal(obj)
})
it('supports instanceof String', () => {
const obj = String('Hello World!')
expect(printName.print(obj)).to.equal('String')
expect(printName.echo(obj)).to.deep.equal(obj)
})
it('supports instanceof Date', () => {
const now = new Date()
expect(printName.print(now)).to.equal('Date')
expect(printName.echo(now)).to.deep.equal(now)
})
it('supports instanceof RegExp', () => {
const regexp = RegExp('.*')
expect(printName.print(regexp)).to.equal('RegExp')
expect(printName.echo(regexp)).to.deep.equal(regexp)
})
it('supports instanceof Buffer', () => {
const buffer = Buffer.from('test')
expect(buffer.equals(printName.echo(buffer))).to.be.true()
@ -484,7 +508,6 @@ ifdescribe(features.isRemoteModuleEnabled())('remote module', () => {
try {
throwFunction(err)
} catch (error) {
expect(error.from).to.equal('browser')
expect(error.cause).to.deep.equal(...resolveGetters(err))
}
})