Skip to content

Commit eb088f7

Browse files
author
Alan Shaw
committed
Better no board instance verify message
1 parent 466d850 commit eb088f7

File tree

9 files changed

+9
-36
lines changed

9 files changed

+9
-36
lines changed

exercises/blink_blink/exercise.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ exercise.addVerifyProcessor(function (callback) {
3838
try {
3939
var io = five.stubs.firmata.singleton
4040

41-
if (!io) {
42-
// yikes, board was never created
43-
return callback(null, false)
44-
}
41+
expect(io, 'no board instance created').to.exist
4542

4643
var led = five.Led.instances[0]
4744

exercises/fire_alarm/exercise.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ exercise.addVerifyProcessor(function (callback) {
4545
try {
4646
var io = five.stubs.firmata.singleton
4747

48-
if (!io) {
49-
// yikes, board was never created
50-
return callback(null, false)
51-
}
48+
expect(io, 'no board instance created').to.exist
5249

5350
// Get the listener that is listening for reads on pin A0
5451
var analogReadListener = null

exercises/light_switch/exercise.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ exercise.addVerifyProcessor(function (callback) {
4949
try {
5050
var io = five.stubs.firmata.singleton
5151

52-
if (!io) {
53-
// yikes, board was never created
54-
return callback(null, false)
55-
}
52+
expect(io, 'no board instance created').to.exist
5653

5754
var btn = five.Button.instances[0]
5855
var led = five.Led.instances[0]

exercises/ping_bell/exercise.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ exercise.addVerifyProcessor(function (callback) {
3939
try {
4040
var io = five.stubs.firmata.singleton
4141

42-
if (!io) {
43-
// yikes, board was never created
44-
return callback(null, false)
45-
}
42+
expect(io, 'no board instance created').to.exist
4643

4744
var piezo = five.Piezo.instances[0]
4845

exercises/remote_temperature/exercise.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ exercise.addVerifyProcessor(function (callback) {
4040
try {
4141
var io = five.stubs.firmata.singleton
4242

43-
if (!io) {
44-
// yikes, board was never created
45-
return callback(null, false)
46-
}
43+
expect(io, 'no board instance created').to.exist
4744

4845
// Get the listener that is listening for reads on pin A0
4946
var analogReadListener = null

exercises/robot_arm/exercise.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ exercise.addVerifyProcessor(function (callback) {
3939
try {
4040
var io = five.stubs.firmata.singleton
4141

42-
if (!io) {
43-
// yikes, board was never created
44-
return callback(null, false)
45-
}
42+
expect(io, 'no board instance created').to.exist
4643

4744
var sensor = five.Sensor.instances[0]
4845
var servo = five.Servo.instances[0]

exercises/servo_wave/exercise.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ exercise.addVerifyProcessor(function (callback) {
3838
try {
3939
var io = five.stubs.firmata.singleton
4040

41-
if (!io) {
42-
// yikes, board was never created
43-
return callback(null, false)
44-
}
41+
expect(io, 'no board instance created').to.exist
4542

4643
var board = five.Board.instances[0]
4744
var servo = five.Servo.instances[0]

exercises/spin_motor_spin/exercise.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ exercise.addVerifyProcessor(function (callback) {
3838
try {
3939
var io = five.stubs.firmata.singleton
4040

41-
if (!io) {
42-
// yikes, board was never created
43-
return callback(null, false)
44-
}
41+
expect(io, 'no board instance created').to.exist
4542

4643
var board = five.Board.instances[0]
4744
var motor = five.Motor.instances[0]

exercises/street_lamp/exercise.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ exercise.addVerifyProcessor(function (callback) {
3838
try {
3939
var io = five.stubs.firmata.singleton
4040

41-
if (!io) {
42-
// yikes, board was never created
43-
return callback(null, false)
44-
}
41+
expect(io, 'no board instance created').to.exist
4542

4643
// Get the listener that is listening for reads on pin A0
4744
var analogReadListener = null

0 commit comments

Comments
 (0)