From 85fa2c06397cccdd33d6873bdaea9a49009f965a Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Wed, 26 Aug 2015 13:26:30 -0400 Subject: [PATCH] Update nanotimer and piezo tests to stop failing on iojs. Fixes gh-890 --- package.json | 2 +- test/piezo.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 2126a4771..8e0ba243e 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ "ease-component": "latest", "es6-shim": "latest", "lodash": "latest", - "nanotimer": "0.3.1", + "nanotimer": "0.3.10", "temporal": "latest", "array-includes": "latest" }, diff --git a/test/piezo.js b/test/piezo.js index 9e5eaf0d3..775eadaae 100644 --- a/test/piezo.js +++ b/test/piezo.js @@ -39,13 +39,13 @@ exports["Piezo"] = { setUp: function(done) { this.board = newBoard(); + this.clock = sinon.useFakeTimers(); this.digitalWrite = sinon.spy(MockFirmata.prototype, "digitalWrite"); this.piezo = new Piezo({ pin: 3, - board: this.board, - timer: this.timer + board: this.board }); this.proto = [{ @@ -248,6 +248,9 @@ exports["Piezo"] = { test.expect(2); var returned = this.piezo.tone(1915, 1000); + + this.clock.tick(100); + test.ok(this.digitalWrite.called); test.equal(returned, this.piezo); @@ -382,6 +385,8 @@ exports["Piezo"] = { test.ok(freqSpy.calledWith(672, 60000 / tempo)); test.done(); }); + + this.clock.tick(100); }, playTuneWithStringSongAndBeat: function(test) { @@ -407,6 +412,8 @@ exports["Piezo"] = { test.ok(freqSpy.calledWith(672, 60000 * beats / tempo)); test.done(); }); + + this.clock.tick(100); }, playCanDealWithWonkyValues: function(test) { @@ -426,5 +433,6 @@ exports["Piezo"] = { test.done(); }.bind(this)); + this.clock.tick(100); }, };