mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
fixes for grunt files tests on Windows
This commit is contained in:
parent
c6436f47eb
commit
2db65b9d1f
@ -128,8 +128,14 @@ describe('nodes/registry/installer', function() {
|
||||
installer.installModule(resourcesDir).then(function() {
|
||||
done(new Error("Unexpected success"));
|
||||
}).otherwise(function(err) {
|
||||
err.code.should.eql(404);
|
||||
done();
|
||||
if (err.hasOwnProperty("code")) {
|
||||
err.code.should.eql(404);
|
||||
done();
|
||||
}
|
||||
else {
|
||||
err.message.should.eql("Install failed");
|
||||
done();
|
||||
}
|
||||
});
|
||||
});
|
||||
it("succeeds when path is valid node-red module", function(done) {
|
||||
|
@ -15,6 +15,7 @@
|
||||
**/
|
||||
var when = require("when");
|
||||
var should = require("should");
|
||||
var paff = require('path');
|
||||
var storage = require("../../../../red/runtime/storage/index");
|
||||
|
||||
describe("red/storage/index", function() {
|
||||
@ -27,17 +28,17 @@ describe("red/storage/index", function() {
|
||||
}
|
||||
};
|
||||
|
||||
storage.init(wrongModule).then( function() {
|
||||
var one = 1;
|
||||
var zero = 0;
|
||||
try {
|
||||
zero.should.equal(one, "The initialization promise should never get resolved");
|
||||
} catch(err) {
|
||||
done(err);
|
||||
}
|
||||
}).catch(function(e) {
|
||||
done(); //successfully rejected promise
|
||||
});
|
||||
storage.init(wrongModule).then( function() {
|
||||
var one = 1;
|
||||
var zero = 0;
|
||||
try {
|
||||
zero.should.equal(one, "The initialization promise should never get resolved");
|
||||
} catch(err) {
|
||||
done(err);
|
||||
}
|
||||
}).catch(function(e) {
|
||||
done(); //successfully rejected promise
|
||||
});
|
||||
});
|
||||
|
||||
it('non-string storage module', function(done) {
|
||||
@ -169,11 +170,11 @@ describe("red/storage/index", function() {
|
||||
},
|
||||
getLibraryEntry : function(type, path) {
|
||||
if (type === "flows") {
|
||||
if (path == "/") {
|
||||
if (path === "/" || path === "\\") {
|
||||
return when.resolve(["a",{fn:"test.json"}]);
|
||||
} else if (path == "/a") {
|
||||
} else if (path == "/a" || path == "\\a") {
|
||||
return when.resolve([{fn:"test2.json"}]);
|
||||
} else if (path == "/a/test2.json") {
|
||||
} else if (path == paff.join("","a","test2.json")) {
|
||||
return when.resolve("test content");
|
||||
}
|
||||
}
|
||||
@ -207,7 +208,7 @@ describe("red/storage/index", function() {
|
||||
});
|
||||
|
||||
it('getFlow',function(done) {
|
||||
storage.getFlow("/a/test2.json").then(function(res) {
|
||||
storage.getFlow(paff.join("a","test2.json")).then(function(res) {
|
||||
try {
|
||||
res.should.eql("test content");
|
||||
done();
|
||||
@ -218,9 +219,9 @@ describe("red/storage/index", function() {
|
||||
});
|
||||
|
||||
it ('saveFlow', function (done) {
|
||||
storage.saveFlow("/a/test2.json","new content").then(function(res) {
|
||||
storage.saveFlow(paff.join("a","test2.json"),"new content").then(function(res) {
|
||||
try {
|
||||
savePath.should.eql("/a/test2.json");
|
||||
savePath.should.eql(paff.join("a","test2.json"));
|
||||
saveContent.should.eql("new content");
|
||||
saveMeta.should.eql({});
|
||||
saveType.should.eql("flows");
|
||||
|
@ -587,10 +587,11 @@ describe('LocalFileSystem', function() {
|
||||
createObjectLibrary();
|
||||
localfilesystem.getLibraryEntry('object','B').then(function(flows) {
|
||||
flows.should.eql([ 'C', { ghi: 'jkl', fn: 'file2.js' }, {fn:'flow.json'} ]);
|
||||
localfilesystem.saveLibraryEntry('object','B/D/file3.js',{mno:'pqr'},"// another non meta line\n\n Hi There").then(function() {
|
||||
localfilesystem.getLibraryEntry('object','B/D').then(function(flows) {
|
||||
var ft = path.join("B","D","file3.js");
|
||||
localfilesystem.saveLibraryEntry('object',ft,{mno:'pqr'},"// another non meta line\n\n Hi There").then(function() {
|
||||
localfilesystem.getLibraryEntry('object',path.join("B","D")).then(function(flows) {
|
||||
flows.should.eql([ { mno: 'pqr', fn: 'file3.js' } ]);
|
||||
localfilesystem.getLibraryEntry('object','B/D/file3.js').then(function(body) {
|
||||
localfilesystem.getLibraryEntry('object',ft).then(function(body) {
|
||||
body.should.eql("// another non meta line\n\n Hi There");
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
|
Loading…
Reference in New Issue
Block a user