1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ignore comms heartbeat messages in comms test

This commit is contained in:
Nick O'Leary 2014-10-31 13:06:08 +00:00
parent 863b85714d
commit f0e9a0279f

View File

@ -174,13 +174,16 @@ describe("comms", function() {
}); });
ws.on('message', function(data) { ws.on('message', function(data) {
var msg = JSON.parse(data); var msg = JSON.parse(data);
msg.should.have.property('topic', 'foo'); // It is possible a heartbeat message may arrive - so ignore them
msg.should.have.property('data', 'bar'); if (msg.topic != "hb") {
count++; msg.should.have.property('topic', 'foo');
if (count == 5) { msg.should.have.property('data', 'bar');
clearInterval(interval); count++;
ws.close(); if (count == 5) {
done(); clearInterval(interval);
ws.close();
done();
}
} }
}); });
}); });