mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Tidy up tail node tests
This commit is contained in:
parent
6b04d512ae
commit
2d92b44f52
@ -64,7 +64,7 @@ describe('TailNode', function() {
|
|||||||
setTimeout( function() {
|
setTimeout( function() {
|
||||||
fs.appendFileSync(fileToTail, "Tail message line 3\n");
|
fs.appendFileSync(fileToTail, "Tail message line 3\n");
|
||||||
fs.appendFileSync(fileToTail, "Tail message line 4\n");
|
fs.appendFileSync(fileToTail, "Tail message line 4\n");
|
||||||
},150);
|
},100);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ describe('TailNode', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('tail should handle file going away and coming back', function(done) {
|
it('tail should handle file truncation', function(done) {
|
||||||
var flow = [{id:"tailNode1", type:"tail", name: "tailNode", "split":true, "filename":fileToTail, "wires":[["helperNode1"]]},
|
var flow = [{id:"tailNode1", type:"tail", name: "tailNode", "split":true, "filename":fileToTail, "wires":[["helperNode1"]]},
|
||||||
{id:"helperNode1", type:"helper", wires:[]}];
|
{id:"helperNode1", type:"helper", wires:[]}];
|
||||||
helper.load(tailNode, flow, function() {
|
helper.load(tailNode, flow, function() {
|
||||||
@ -96,19 +96,18 @@ describe('TailNode', function() {
|
|||||||
var warned = false;
|
var warned = false;
|
||||||
tailNode1.on("log", function(msg) {
|
tailNode1.on("log", function(msg) {
|
||||||
if (msg.level == "warn") { warned = true; }
|
if (msg.level == "warn") { warned = true; }
|
||||||
if ((inputCounter === 3)&&(warned === true)) { done(); }
|
|
||||||
});
|
});
|
||||||
helperNode1.on("input", function(msg) {
|
helperNode1.on("input", function(msg) {
|
||||||
msg.should.have.property('topic', fileToTail);
|
msg.should.have.property('topic', fileToTail);
|
||||||
msg.payload.should.equal("Tail message line A");
|
msg.payload.should.equal("Tail message line A");
|
||||||
inputCounter += 1;
|
if ((++inputCounter === 3) && (warned === true)) { done(); }
|
||||||
if ((inputCounter === 3)&&(warned === true)) { done(); }
|
|
||||||
});
|
});
|
||||||
fs.writeFileSync(fileToTail, "Tail message line A\n");
|
|
||||||
setTimeout( function() {
|
setTimeout( function() {
|
||||||
|
fs.writeFileSync(fileToTail, "Tail message line A\n");
|
||||||
fs.appendFileSync(fileToTail, "Tail message line A\n");
|
fs.appendFileSync(fileToTail, "Tail message line A\n");
|
||||||
fs.appendFileSync(fileToTail, "Tail message line A\n");
|
fs.appendFileSync(fileToTail, "Tail message line A\n");
|
||||||
},150);
|
fs.appendFileSync(fileToTail, "Tail message line A\n");
|
||||||
|
},200);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user