Skip to content

Commit

Permalink
Board.Controller: fix warn messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Oct 14, 2015
1 parent fd7fa13 commit 57c5ab5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ Board.Controller = function(controller, options) {
if (requirements.options[key].throws) {
throw new Error(requirements.options[key].message);
} else {
this.board.warn(requirements.options[key].message);
this.board.warn(this.constructor.name, requirements.options[key].message);
}
}
}, this);
Expand Down
6 changes: 4 additions & 2 deletions test/altimeter.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ exports["Altimeter -- MPL3115A2"] = {
},

missingRequirements: function(test) {
test.expect(2);
test.expect(3);

new Altimeter({
controller: "MPL3115A2",
Expand All @@ -143,7 +143,9 @@ exports["Altimeter -- MPL3115A2"] = {
});

test.equal(this.warn.callCount, 1);
test.equal(this.warn.getCall(0).args[0], "Missing `elevation` option. Without a specified base `elevation`, the altitude measurement will be inaccurate. Use whatismyelevation.com");
test.equal(this.warn.getCall(0).args[0], "Altimeter");

test.equal(this.warn.getCall(0).args[1], "Missing `elevation` option. Without a specified base `elevation`, the altitude measurement will be inaccurate. Use whatismyelevation.com");

test.done();
},
Expand Down
4 changes: 3 additions & 1 deletion test/board.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ exports["Board.Controller"] = {
},

requirementsMissingWarning: function(test) {
test.expect(2);
test.expect(4);

var context = {
board: this.board
Expand All @@ -98,6 +98,8 @@ exports["Board.Controller"] = {

Board.Controller.call(context, controller, options);

test.equal(this.warn.getCall(0).args[0], "Object");
test.equal(this.warn.getCall(0).args[1], "message");
test.equal(this.warn.callCount, 1);
test.equal(this.odp.callCount, 1);

Expand Down

0 comments on commit 57c5ab5

Please sign in to comment.