From 5800ed41f107333ee5fcd2713d8b9120b8b60945 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 31 Aug 2018 21:19:26 +0100 Subject: [PATCH] Handle expected closed status event in gpio tests --- test/nodes/core/hardware/36-rpi-gpio_spec.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/test/nodes/core/hardware/36-rpi-gpio_spec.js b/test/nodes/core/hardware/36-rpi-gpio_spec.js index 871dabcf9..6f278b510 100644 --- a/test/nodes/core/hardware/36-rpi-gpio_spec.js +++ b/test/nodes/core/hardware/36-rpi-gpio_spec.js @@ -132,13 +132,19 @@ describe('RPI GPIO Node', function() { var n1 = helper.getNode("n1"); var n2 = helper.getNode("n2"); var n3 = helper.getNode("n3"); + var count = 0; n3.on("input", function(msg) { - try { - msg.should.have.property('status'); - msg.status.should.have.property('text', "rpi-gpio.status.na"); - done(); - } catch(err) { - done(err); + // Only check the first status message received as it may get a + // 'closed' status as the test is tidied up. + if (count === 0) { + count++; + try { + msg.should.have.property('status'); + msg.status.should.have.property('text', "rpi-gpio.status.na"); + done(); + } catch(err) { + done(err); + } } }); n1.receive({payload:"1"});