From 0e55e5cbb5040e8131a7d69c349ca9f1764bc434 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 16 Mar 2017 14:54:48 -0700 Subject: [PATCH] Add initial spec for clipboard.readBuffer --- spec/api-clipboard-spec.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/api-clipboard-spec.js b/spec/api-clipboard-spec.js index fdd5711..19f1799 100644 --- a/spec/api-clipboard-spec.js +++ b/spec/api-clipboard-spec.js @@ -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'))) + }) + }) }) -- 2.7.4