From 554e944105429078588a736787a2bd5fb56efd6a Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 24 Aug 2016 14:49:25 -0700 Subject: [PATCH] Add test of sending Buffer --- spec/api-ipc-spec.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spec/api-ipc-spec.js b/spec/api-ipc-spec.js index 8d08baf0bcbf..829d26dd8819 100644 --- a/spec/api-ipc-spec.js +++ b/spec/api-ipc-spec.js @@ -286,7 +286,7 @@ describe('ipc module', function () { ipcRenderer.send('message', obj) }) - it('can send instance of Date', function (done) { + it('can send instances of Date', function (done) { const currentDate = new Date() ipcRenderer.once('message', function (event, value) { assert.equal(value, currentDate.toISOString()) @@ -295,6 +295,15 @@ describe('ipc module', function () { ipcRenderer.send('message', currentDate) }) + it('can send instances of Buffer', function (done) { + var buffer = Buffer.from('hello') + ipcRenderer.once('message', function (event, message) { + assert.ok(buffer.equals(message)) + done() + }) + ipcRenderer.send('message', buffer) + }) + it('can send objects with DOM class prototypes', function (done) { ipcRenderer.once('message', function (event, value) { assert.equal(value.protocol, 'file:')