diff --git a/spec/api-ipc-spec.js b/spec/api-ipc-spec.js index bd1a7e3d86b7..01ab4fa0ff2d 100644 --- a/spec/api-ipc-spec.js +++ b/spec/api-ipc-spec.js @@ -142,20 +142,25 @@ describe('ipc module', function () { }) describe('remote value in browser', function () { - var print = path.join(fixtures, 'module', 'print_name.js') + const print = path.join(fixtures, 'module', 'print_name.js') + const printName = remote.require(print) it('keeps its constructor name for objects', function () { - var buf = new Buffer('test') - var printName = remote.require(print) + const buf = new Buffer('test') assert.equal(printName.print(buf), 'Buffer') }) it('supports instanceof Date', function () { - var now = new Date() - var printName = remote.require(print) + const now = new Date() assert.equal(printName.print(now), 'Date') assert.deepEqual(printName.echo(now), now) }) + + it('supports TypedArray', function () { + const values = [1, 2, 3, 4] + const typedArray = printName.typedArray(values) + assert.equal(values.toString(), typedArray.toString()) + }) }) describe('remote promise', function () { diff --git a/spec/fixtures/module/print_name.js b/spec/fixtures/module/print_name.js index db4f71d407b6..fff59200edab 100644 --- a/spec/fixtures/module/print_name.js +++ b/spec/fixtures/module/print_name.js @@ -5,3 +5,11 @@ exports.print = function (obj) { exports.echo = function (obj) { return obj } + +exports.typedArray = function (name) { + const int16 = new Int16Array(name.length) + for (let i = 0; i < name.length; ++i) { + int16[i] = name[i] + } + return int16 +}