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

Add more delays to tail node test

This commit is contained in:
Nick O'Leary 2014-08-27 23:40:17 +01:00
parent 691ef12e04
commit bac288fa52

View File

@ -118,6 +118,8 @@ describe('TailNode', function() {
if (msg.level == "warn") { warned = true; } if (msg.level == "warn") { warned = true; }
}); });
helperNode1.on("input", function(msg) { helperNode1.on("input", function(msg) {
console.log("inputCounter =",inputCounter);
console.log(msg);
msg.should.have.property('topic', fileToTail); msg.should.have.property('topic', fileToTail);
inputCounter++; inputCounter++;
if (inputCounter === 1) { if (inputCounter === 1) {
@ -136,12 +138,25 @@ describe('TailNode', function() {
},100); },100);
} }
}); });
var actions = [
function() { fs.appendFileSync(fileToTail, "Tail message line append\n");},
function() { fs.writeFileSync(fileToTail, "Tail message line truncate\n");},
function() { fs.appendFileSync(fileToTail, "Tail message line append 3\n");},
function() { fs.appendFileSync(fileToTail, "Tail message line append 4\n");},
function() { fs.appendFileSync(fileToTail, "Tail message line append 5\n");}
];
function processAction() {
var action = actions.shift();
action();
if (actions.length > 0) {
setTimeout(function() {
processAction();
},250);
}
}
setTimeout( function() { setTimeout( function() {
fs.appendFileSync(fileToTail, "Tail message line append\n"); processAction();
fs.writeFileSync(fileToTail, "Tail message line truncate\n");
fs.appendFileSync(fileToTail, "Tail message line append 3\n");
fs.appendFileSync(fileToTail, "Tail message line append 4\n");
fs.appendFileSync(fileToTail, "Tail message line append 5\n");
},150); },150);
}); });
}); });