Add test of sending Buffer

This commit is contained in:
Kevin Sawicki 2016-08-24 14:49:25 -07:00
parent a97b40eff5
commit 554e944105

View file

@ -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:')