Skip to content

Commit

Permalink
Update nanotimer and piezo tests to stop failing on iojs. Fixes gh-890
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Aug 26, 2015
1 parent 0445a00 commit 85fa2c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
12 changes: 10 additions & 2 deletions test/piezo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [{
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -382,6 +385,8 @@ exports["Piezo"] = {
test.ok(freqSpy.calledWith(672, 60000 / tempo));
test.done();
});

this.clock.tick(100);
},

playTuneWithStringSongAndBeat: function(test) {
Expand All @@ -407,6 +412,8 @@ exports["Piezo"] = {
test.ok(freqSpy.calledWith(672, 60000 * beats / tempo));
test.done();
});

this.clock.tick(100);
},

playCanDealWithWonkyValues: function(test) {
Expand All @@ -426,5 +433,6 @@ exports["Piezo"] = {
test.done();
}.bind(this));

this.clock.tick(100);
},
};

0 comments on commit 85fa2c0

Please sign in to comment.