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(); + } } }); });