Merge branch '0.19' into runtime-api

This commit is contained in:
Nick O'Leary
2018-06-06 21:59:46 +01:00
35 changed files with 1277 additions and 464 deletions

View File

@@ -197,8 +197,7 @@ describe("api/auth/users", function() {
it('should fail to return user fred',function(done) {
Users.get("fred").then(function(userf) {
try {
userf.should.not.have.a.property("username","fred");
userf.should.not.have.a.property("permissions","*");
should.not.exist(userf);
done();
} catch(err) {
done(err);
@@ -215,6 +214,9 @@ describe("api/auth/users", function() {
default: function() { return("Done"); }
});
});
after(function() {
Users.init({});
});
describe('#default',function() {
it('handles api.default being a function',function(done) {
Users.should.have.property('default').which.is.a.Function();

View File

@@ -540,7 +540,7 @@ describe("red/nodes/registry/registry",function() {
}
},icons: [{path:testIcon,icons:['test_icon.png']}]});
var iconPath = typeRegistry.getNodeIconPath('test-module','test_icon.png');
iconPath.should.eql(testIcon+"/test_icon.png");
iconPath.should.eql(path.resolve(testIcon+"/test_icon.png"));
});
it('returns the debug icon when getting an unknown module', function() {

View File

@@ -19,6 +19,13 @@ var should = require("should");
var defaultFileSet = require("../../../../../../red/runtime/storage/localfilesystem/projects/defaultFileSet");
describe('storage/localfilesystem/projects/defaultFileSet', function() {
var runtime = {
i18n: {
"_": function(name) {
return name;
}
}
};
it('generates package.json for a project', function() {
var generated = defaultFileSet["package.json"]({
name: "A TEST NAME",
@@ -27,7 +34,7 @@ describe('storage/localfilesystem/projects/defaultFileSet', function() {
flow: "MY FLOW FILE",
credentials: "MY CREDENTIALS FILE"
}
});
}, runtime);
var parsed = JSON.parse(generated);
parsed.should.have.property('name',"A TEST NAME");
@@ -42,7 +49,7 @@ describe('storage/localfilesystem/projects/defaultFileSet', function() {
var generated = defaultFileSet["README.md"]({
name: "A TEST NAME",
summary: "A TEST SUMMARY"
});
}, runtime);
generated.should.match(/A TEST NAME/);
generated.should.match(/A TEST SUMMARY/);
});
@@ -50,7 +57,7 @@ describe('storage/localfilesystem/projects/defaultFileSet', function() {
var generated = defaultFileSet[".gitignore"]({
name: "A TEST NAME",
summary: "A TEST SUMMARY"
});
}, runtime);
generated.length.should.be.greaterThan(0);
});
});