From f0e9a0279f6ff040db297aa0a84394d8a084ee33 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 31 Oct 2014 13:06:08 +0000 Subject: [PATCH] Ignore comms heartbeat messages in comms test --- test/red/comms_spec.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/red/comms_spec.js b/test/red/comms_spec.js index dce4d83af..19cd02fa6 100644 --- a/test/red/comms_spec.js +++ b/test/red/comms_spec.js @@ -174,13 +174,16 @@ describe("comms", function() { }); ws.on('message', function(data) { var msg = JSON.parse(data); - msg.should.have.property('topic', 'foo'); - msg.should.have.property('data', 'bar'); - count++; - if (count == 5) { - clearInterval(interval); - ws.close(); - done(); + // It is possible a heartbeat message may arrive - so ignore them + if (msg.topic != "hb") { + msg.should.have.property('topic', 'foo'); + msg.should.have.property('data', 'bar'); + count++; + if (count == 5) { + clearInterval(interval); + ws.close(); + done(); + } } }); });