Add initial spec for clipboard.readBuffer

This commit is contained in:
Kevin Sawicki 2017-03-16 14:54:48 -07:00
parent fe5db82d47
commit 0e55e5cbb5

View file

@ -1,5 +1,6 @@
const assert = require('assert')
const path = require('path')
const {Buffer} = require('buffer')
const clipboard = require('electron').clipboard
const nativeImage = require('electron').nativeImage
@ -93,4 +94,14 @@ describe('clipboard module', function () {
assert.equal(clipboard.readFindText(), 'find this')
})
})
describe('clipboard.readBuffer(format)', function () {
it('returns a Buffer of the content for the specified format', function () {
if (process.platform !== 'darwin') return
const buffer = Buffer.from('this is binary', 'utf8')
clipboard.writeText(buffer.toString())
assert(buffer.equals(clipboard.readBuffer('public.utf8-plain-text')))
})
})
})