mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
better tests for windows nodes
This commit is contained in:
parent
6264104642
commit
06ffe722d4
@ -413,7 +413,7 @@ describe('trigger node', function() {
|
|||||||
n1.emit("input", {payload:"foo"}); // trigger
|
n1.emit("input", {payload:"foo"}); // trigger
|
||||||
setTimeout( function() {
|
setTimeout( function() {
|
||||||
n1.emit("input", {reset:true}); // reset
|
n1.emit("input", {reset:true}); // reset
|
||||||
},90);
|
},95);
|
||||||
setTimeout( function() {
|
setTimeout( function() {
|
||||||
c.should.equal(4); // should send foo 4 times.
|
c.should.equal(4); // should send foo 4 times.
|
||||||
done();
|
done();
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
var os = require('os');
|
||||||
var fs = require('fs-extra');
|
var fs = require('fs-extra');
|
||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
var tailNode = require("../../../../nodes/core/storage/28-tail.js");
|
var tailNode = require("../../../../nodes/core/storage/28-tail.js");
|
||||||
@ -39,6 +40,7 @@ describe('tail Node', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (os.type() !== "Windows_NT") {
|
||||||
it('should be loaded', function(done) {
|
it('should be loaded', function(done) {
|
||||||
var flow = [{id:"tailNode1", type:"tail", name: "tailNode", "split":true, "filename":fileToTail}];
|
var flow = [{id:"tailNode1", type:"tail", name: "tailNode", "split":true, "filename":fileToTail}];
|
||||||
helper.load(tailNode, flow, function() {
|
helper.load(tailNode, flow, function() {
|
||||||
@ -126,6 +128,7 @@ describe('tail Node', function() {
|
|||||||
},1000);
|
},1000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
it('should throw an error if run on Windows', function(done) {
|
it('should throw an error if run on Windows', function(done) {
|
||||||
// Stub os platform so we can make it look like windows
|
// Stub os platform so we can make it look like windows
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var fs = require('fs-extra');
|
var fs = require('fs-extra');
|
||||||
|
var os = require('os');
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var fileNode = require("../../../../nodes/core/storage/50-file.js");
|
var fileNode = require("../../../../nodes/core/storage/50-file.js");
|
||||||
var helper = require("../../helper.js");
|
var helper = require("../../helper.js");
|
||||||
@ -80,8 +81,14 @@ describe('file Nodes', function() {
|
|||||||
},90);
|
},90);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var f = fs.readFileSync(fileToTest).toString();
|
var f = fs.readFileSync(fileToTest).toString();
|
||||||
|
if (os.type() !== "Windows_NT") {
|
||||||
f.should.have.length(19);
|
f.should.have.length(19);
|
||||||
f.should.equal("test2\ntrue\n999\n[2]\n");
|
f.should.equal("test2\ntrue\n999\n[2]\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
f.should.have.length(23);
|
||||||
|
f.should.equal("test2\r\ntrue\r\n999\r\n[2]\r\n");
|
||||||
|
}
|
||||||
done();
|
done();
|
||||||
},wait);
|
},wait);
|
||||||
});
|
});
|
||||||
@ -94,8 +101,14 @@ describe('file Nodes', function() {
|
|||||||
n1.emit("input", {payload:"fine", filename:fileToTest});
|
n1.emit("input", {payload:"fine", filename:fileToTest});
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var f = fs.readFileSync(fileToTest).toString();
|
var f = fs.readFileSync(fileToTest).toString();
|
||||||
|
if (os.type() !== "Windows_NT") {
|
||||||
f.should.have.length(5);
|
f.should.have.length(5);
|
||||||
f.should.equal("fine\n");
|
f.should.equal("fine\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
f.should.have.length(6);
|
||||||
|
f.should.equal("fine\r\n");
|
||||||
|
}
|
||||||
done();
|
done();
|
||||||
},wait);
|
},wait);
|
||||||
});
|
});
|
||||||
|
@ -133,7 +133,8 @@ describe('nodes/registry/installer', function() {
|
|||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
err.message.should.eql("Install failed");
|
console.log("ERRROR::"+err.toString()+"::");
|
||||||
|
err.toString().should.eql("Error: Install failed");
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user