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

Update delay burst test to be more tolerant of timing

Fixes #1013
This commit is contained in:
Nick O'Leary 2016-10-14 22:35:43 +01:00
parent 90f4db9158
commit 714c254bab

View File

@ -429,14 +429,17 @@ describe('delay Node', function() {
// we ensure that we note that a warning is received for buffer growth // we ensure that we note that a warning is received for buffer growth
sinon.stub(delayNode1, 'warn', function(warning) { sinon.stub(delayNode1, 'warn', function(warning) {
if (warning.indexOf("buffer exceeded 1000 messages" > -1)) { receivedWarning = true;
receivedWarning = true;
}
}); });
// we ensure that the warning is received for buffer size and that we get the last message // we ensure that the warning is received for buffer size and that we get the last message
helperNode1.on("input", function(msg) { helperNode1.on("input", function(msg) {
if (msg.payload === (messageBurstSize - 1) && receivedWarning === true) { if (msg.payload === (messageBurstSize - 1)) {
done(); // it will timeout if we don't receive the last message try {
receivedWarning.should.be.true();
done();
} catch(err) {
done(err);
}
} }
}); });
// send messages as quickly as possible // send messages as quickly as possible