Throw error when non-Buffer specified instead of crashing

This commit is contained in:
Kevin Sawicki 2017-05-22 13:53:58 -07:00
parent 5adf9c47fc
commit 6b7ec621e3
2 changed files with 13 additions and 3 deletions

View file

@ -109,6 +109,12 @@ describe('clipboard module', function () {
clipboard.writeBuffer('public.utf8-plain-text', buffer)
assert.equal(clipboard.readText(), 'writeBuffer')
})
it('throws an error when a non-Buffer is specified', () => {
assert.throws(() => {
clipboard.writeBuffer('public.utf8-plain-text', 'hello')
}, /buffer must be a node Buffer/)
})
})
describe('clipboard.readBuffer(format)', function () {