Skip to content

Commit

Permalink
Led.RGB Tests: Add assertions for non-PWM pins
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgonzalez committed May 26, 2015
1 parent 7a91d9c commit e0b967d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/led.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ exports["Led.RGB"] = {
params: function(test) {
var led;

test.expect(3);
test.expect(5);

// Test object constructor
led = new Led.RGB({
Expand All @@ -570,6 +570,20 @@ exports["Led.RGB"] = {
led = new Led.RGB([9, 10, 11]);
test.deepEqual(led.pins, [9, 10, 11]);

// Non-PWM digital pin
test.throws(function() {
new Led.RGB({
pins: [2, 3, 4]
});
}, /Pin Error: 2 is not a valid PWM pin \(Led\.RGB\)/);

// Analog pin
test.throws(function() {
new Led.RGB({
pins: ["A0", "A1", "A2"]
});
}, /Pin Error: \d+ is not a valid PWM pin \(Led\.RGB\)/);

test.done();
},

Expand Down

0 comments on commit e0b967d

Please sign in to comment.