mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Add tail node binary mode test
This commit is contained in:
@@ -88,6 +88,24 @@ describe('tail Node', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('should work in binary mode', function(done) {
|
||||
var flow = [{id:"tailNode1", type:"tail", name: "tailNode", "filetype":"binary", "filename":fileToTail, "wires":[["helperNode1"]]},
|
||||
{id:"helperNode1", type:"helper", wires:[]}];
|
||||
helper.load(tailNode, flow, function() {
|
||||
var tailNode1 = helper.getNode("tailNode1");
|
||||
var helperNode1 = helper.getNode("helperNode1");
|
||||
helperNode1.on("input", function(msg) {
|
||||
//console.log(msg);
|
||||
msg.should.have.property('topic', fileToTail);
|
||||
msg.payload.toString().should.equal("Tail message line 7\nTail message line 8\n");
|
||||
done();
|
||||
});
|
||||
setTimeout( function() {
|
||||
fs.appendFileSync(fileToTail, "Tail message line 7\nTail message line 8\n");
|
||||
},wait);
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle a non-existent file', function(done) {
|
||||
fs.writeFileSync(fileToTail, "Tail message line.\n");
|
||||
var flow = [{id:"tailNode1", type:"tail", name: "tailNode", "split":true, "filename":fileToTail, "wires":[["helperNode1"]]},
|
||||
|
Reference in New Issue
Block a user