From 648a7f556a743a1fe8e8fd35a52c3f78b209a69b Mon Sep 17 00:00:00 2001 From: "greenkeeper[bot]" Date: Sun, 6 Aug 2017 20:26:32 -0400 Subject: [PATCH] chore(package): update sinon to version 3.0.0 (#1280) --- package.json | 2 +- test/serialport.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 0ca239eb0..59df860f0 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "mocha": "^3.4.2", "prebuild": "^6.2.1", "proxyquire": "^1.7.10", - "sinon": "^2.3.8" + "sinon": "^3.0.0" }, "engines": { "node": ">=4.0.0" diff --git a/test/serialport.js b/test/serialport.js index 62ac924d7..45d29e494 100644 --- a/test/serialport.js +++ b/test/serialport.js @@ -230,7 +230,7 @@ describe('SerialPort', () => { it('returns false when the port is opening', (done) => { const port = new SerialPort('/dev/exists', { autoOpen: false }); - sandbox.stub(port.binding, 'open').callsFake(() => { + sandbox.stub(SerialPort.Binding.prototype, 'open').callsFake(() => { assert.isTrue(port.opening); assert.isFalse(port.isOpen); done(); @@ -246,14 +246,14 @@ describe('SerialPort', () => { }); it('returns false when the port is closing', (done) => { - const port = new SerialPort('/dev/exists', {}, function() { - sandbox.stub(this.binding, 'close').callsFake(() => { - assert.isFalse(port.isOpen); - done(); - return Promise.resolve(); - }); + const port = new SerialPort('/dev/exists', {}, () => { port.close(); }); + sandbox.stub(SerialPort.Binding.prototype, 'close').callsFake(() => { + assert.isFalse(port.isOpen); + done(); + return Promise.resolve(); + }); }); it('returns false when the port is closed', (done) => { @@ -295,7 +295,7 @@ describe('SerialPort', () => { stopBits: 1 }; const port = new SerialPort('/dev/exists', { autoOpen: false }); - sandbox.stub(port.binding, 'open').callsFake((path, opt) => { + sandbox.stub(SerialPort.Binding.prototype, 'open').callsFake((path, opt) => { assert.equal(path, '/dev/exists'); assert.containSubset(opt, defaultOptions); done(); @@ -348,7 +348,7 @@ describe('SerialPort', () => { it('allows opening after an open error', (done) => { const port = new SerialPort('/dev/exists', { autoOpen: false }); - const stub = sandbox.stub(port.binding, 'open').callsFake(() => { + const stub = sandbox.stub(SerialPort.Binding.prototype, 'open').callsFake(() => { return Promise.reject(new Error('Haha no')); }); port.open((err) => {