From 2d92b44f527b0914d44a056b02480f7d1f994dbc Mon Sep 17 00:00:00 2001 From: Dave C-J Date: Wed, 27 Aug 2014 10:41:25 +0100 Subject: [PATCH] Tidy up tail node tests --- test/nodes/core/storage/28-tail_spec.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/nodes/core/storage/28-tail_spec.js b/test/nodes/core/storage/28-tail_spec.js index b5826a3cb..c60bf6095 100644 --- a/test/nodes/core/storage/28-tail_spec.js +++ b/test/nodes/core/storage/28-tail_spec.js @@ -64,7 +64,7 @@ describe('TailNode', function() { setTimeout( function() { fs.appendFileSync(fileToTail, "Tail message line 3\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"]]}, {id:"helperNode1", type:"helper", wires:[]}]; helper.load(tailNode, flow, function() { @@ -96,19 +96,18 @@ describe('TailNode', function() { var warned = false; tailNode1.on("log", function(msg) { if (msg.level == "warn") { warned = true; } - if ((inputCounter === 3)&&(warned === true)) { done(); } }); helperNode1.on("input", function(msg) { msg.should.have.property('topic', fileToTail); 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() { + fs.writeFileSync(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); }); });