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() {
|
installer.installModule(resourcesDir).then(function() {
|
||||||
done(new Error("Unexpected success"));
|
done(new Error("Unexpected success"));
|
||||||
}).otherwise(function(err) {
|
}).otherwise(function(err) {
|
||||||
|
if (err.hasOwnProperty("code")) {
|
||||||
err.code.should.eql(404);
|
err.code.should.eql(404);
|
||||||
done();
|
done();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
err.message.should.eql("Install failed");
|
||||||
|
done();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it("succeeds when path is valid node-red module", function(done) {
|
it("succeeds when path is valid node-red module", function(done) {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
var when = require("when");
|
var when = require("when");
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
|
var paff = require('path');
|
||||||
var storage = require("../../../../red/runtime/storage/index");
|
var storage = require("../../../../red/runtime/storage/index");
|
||||||
|
|
||||||
describe("red/storage/index", function() {
|
describe("red/storage/index", function() {
|
||||||
@ -169,11 +170,11 @@ describe("red/storage/index", function() {
|
|||||||
},
|
},
|
||||||
getLibraryEntry : function(type, path) {
|
getLibraryEntry : function(type, path) {
|
||||||
if (type === "flows") {
|
if (type === "flows") {
|
||||||
if (path == "/") {
|
if (path === "/" || path === "\\") {
|
||||||
return when.resolve(["a",{fn:"test.json"}]);
|
return when.resolve(["a",{fn:"test.json"}]);
|
||||||
} else if (path == "/a") {
|
} else if (path == "/a" || path == "\\a") {
|
||||||
return when.resolve([{fn:"test2.json"}]);
|
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");
|
return when.resolve("test content");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,7 +208,7 @@ describe("red/storage/index", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('getFlow',function(done) {
|
it('getFlow',function(done) {
|
||||||
storage.getFlow("/a/test2.json").then(function(res) {
|
storage.getFlow(paff.join("a","test2.json")).then(function(res) {
|
||||||
try {
|
try {
|
||||||
res.should.eql("test content");
|
res.should.eql("test content");
|
||||||
done();
|
done();
|
||||||
@ -218,9 +219,9 @@ describe("red/storage/index", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it ('saveFlow', function (done) {
|
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 {
|
try {
|
||||||
savePath.should.eql("/a/test2.json");
|
savePath.should.eql(paff.join("a","test2.json"));
|
||||||
saveContent.should.eql("new content");
|
saveContent.should.eql("new content");
|
||||||
saveMeta.should.eql({});
|
saveMeta.should.eql({});
|
||||||
saveType.should.eql("flows");
|
saveType.should.eql("flows");
|
||||||
|
@ -587,10 +587,11 @@ describe('LocalFileSystem', function() {
|
|||||||
createObjectLibrary();
|
createObjectLibrary();
|
||||||
localfilesystem.getLibraryEntry('object','B').then(function(flows) {
|
localfilesystem.getLibraryEntry('object','B').then(function(flows) {
|
||||||
flows.should.eql([ 'C', { ghi: 'jkl', fn: 'file2.js' }, {fn:'flow.json'} ]);
|
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() {
|
var ft = path.join("B","D","file3.js");
|
||||||
localfilesystem.getLibraryEntry('object','B/D').then(function(flows) {
|
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' } ]);
|
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");
|
body.should.eql("// another non meta line\n\n Hi There");
|
||||||
done();
|
done();
|
||||||
}).otherwise(function(err) {
|
}).otherwise(function(err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user