mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Move exec and events components to util module
The exec and events components are common components that are used by both runtime and registry. It makes sense to move them into the util package. This also adds some docs to the registry module
This commit is contained in:
@@ -53,7 +53,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
}
|
||||
describe("#getNodeFiles",function() {
|
||||
it("Finds all the node files in the resources tree",function(done) {
|
||||
localfilesystem.init({settings:{coreNodesDir:resourcesDir}});
|
||||
localfilesystem.init({coreNodesDir:resourcesDir});
|
||||
var nodeList = localfilesystem.getNodeFiles(true);
|
||||
nodeList.should.have.a.property("node-red");
|
||||
var nm = nodeList['node-red'];
|
||||
@@ -68,7 +68,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
done();
|
||||
});
|
||||
it("Includes node files from settings",function(done) {
|
||||
localfilesystem.init({settings:{nodesIncludes:['TestNode1.js'],coreNodesDir:resourcesDir}});
|
||||
localfilesystem.init({nodesIncludes:['TestNode1.js'],coreNodesDir:resourcesDir});
|
||||
var nodeList = localfilesystem.getNodeFiles(true);
|
||||
nodeList.should.have.a.property("node-red");
|
||||
var nm = nodeList['node-red'];
|
||||
@@ -78,7 +78,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
done();
|
||||
});
|
||||
it("Excludes node files from settings",function(done) {
|
||||
localfilesystem.init({settings:{nodesExcludes:['TestNode1.js'],coreNodesDir:resourcesDir}});
|
||||
localfilesystem.init({nodesExcludes:['TestNode1.js'],coreNodesDir:resourcesDir});
|
||||
var nodeList = localfilesystem.getNodeFiles(true);
|
||||
nodeList.should.have.a.property("node-red");
|
||||
var nm = nodeList['node-red'];
|
||||
@@ -88,7 +88,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
done();
|
||||
});
|
||||
it("Finds nodes in userDir/nodes",function(done) {
|
||||
localfilesystem.init({settings:{userDir:userDir}});
|
||||
localfilesystem.init({userDir:userDir});
|
||||
var nodeList = localfilesystem.getNodeFiles(true);
|
||||
nodeList.should.have.a.property("node-red");
|
||||
var nm = nodeList['node-red'];
|
||||
@@ -99,7 +99,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
});
|
||||
|
||||
it("Finds nodes in settings.nodesDir (string)",function(done) {
|
||||
localfilesystem.init({settings:{nodesDir:userDir}});
|
||||
localfilesystem.init({nodesDir:userDir});
|
||||
var nodeList = localfilesystem.getNodeFiles(true);
|
||||
nodeList.should.have.a.property("node-red");
|
||||
var nm = nodeList['node-red'];
|
||||
@@ -110,7 +110,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
});
|
||||
it("Finds nodes in settings.nodesDir (string,relative path)",function(done) {
|
||||
var relativeUserDir = path.join("test","unit","@node-red","registry","lib","resources","userDir");
|
||||
localfilesystem.init({settings:{nodesDir:relativeUserDir}});
|
||||
localfilesystem.init({nodesDir:relativeUserDir});
|
||||
var nodeList = localfilesystem.getNodeFiles(true);
|
||||
nodeList.should.have.a.property("node-red");
|
||||
var nm = nodeList['node-red'];
|
||||
@@ -120,7 +120,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
done();
|
||||
});
|
||||
it("Finds nodes in settings.nodesDir (array)",function(done) {
|
||||
localfilesystem.init({settings:{nodesDir:[userDir]}});
|
||||
localfilesystem.init({nodesDir:[userDir]});
|
||||
var nodeList = localfilesystem.getNodeFiles(true);
|
||||
nodeList.should.have.a.property("node-red");
|
||||
var nm = nodeList['node-red'];
|
||||
@@ -139,7 +139,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
}
|
||||
return _join.apply(null,arguments);
|
||||
}));
|
||||
localfilesystem.init({settings:{coreNodesDir:moduleDir}});
|
||||
localfilesystem.init({coreNodesDir:moduleDir});
|
||||
var nodeList = localfilesystem.getNodeFiles();
|
||||
nodeList.should.have.a.property("node-red");
|
||||
var nm = nodeList['node-red'];
|
||||
@@ -175,18 +175,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
it("scans icon files in the resources tree",function(done) {
|
||||
var count = 0;
|
||||
localfilesystem.init({
|
||||
|
||||
// events:{emit:function(eventName,dir){
|
||||
// if (count === 0) {
|
||||
// eventName.should.equal("node-icon-dir");
|
||||
// dir.name.should.equal("node-red");
|
||||
// dir.icons.should.be.an.Array();
|
||||
// count = 1;
|
||||
// } else if (count === 1) {
|
||||
// done();
|
||||
// }
|
||||
// }},
|
||||
settings:{coreNodesDir:resourcesDir}
|
||||
coreNodesDir: resourcesDir
|
||||
});
|
||||
var list = localfilesystem.getNodeFiles(true);
|
||||
list.should.have.property("node-red");
|
||||
@@ -201,22 +190,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
it("scans icons dir in library",function(done) {
|
||||
var count = 0;
|
||||
localfilesystem.init({
|
||||
//
|
||||
// events:{emit:function(eventName,dir){
|
||||
// eventName.should.equal("node-icon-dir");
|
||||
// if (count === 0) {
|
||||
// dir.name.should.equal("node-red");
|
||||
// dir.icons.should.be.an.Array();
|
||||
// count = 1;
|
||||
// } else if (count === 1) {
|
||||
// dir.name.should.equal("Library");
|
||||
// dir.icons.should.be.an.Array();
|
||||
// dir.icons.length.should.equal(1);
|
||||
// dir.icons[0].should.be.equal("test_icon.png");
|
||||
// done();
|
||||
// }
|
||||
// }},
|
||||
settings:{userDir:userDir}
|
||||
userDir: userDir
|
||||
});
|
||||
var list = localfilesystem.getNodeFiles(true);
|
||||
list.should.have.property("node-red");
|
||||
@@ -240,7 +214,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
}
|
||||
return _join.apply(null,arguments);
|
||||
}));
|
||||
localfilesystem.init({settings:{coreNodesDir:moduleDir}});
|
||||
localfilesystem.init({coreNodesDir:moduleDir});
|
||||
var nodeModule = localfilesystem.getModuleFiles('TestNodeModule');
|
||||
nodeModule.should.have.a.property('TestNodeModule');
|
||||
nodeModule['TestNodeModule'].should.have.a.property('name','TestNodeModule');
|
||||
@@ -266,7 +240,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
}
|
||||
return _join.apply(null,arguments);
|
||||
}));
|
||||
localfilesystem.init({settings:{coreNodesDir:moduleDir}});
|
||||
localfilesystem.init({coreNodesDir:moduleDir});
|
||||
/*jshint immed: false */
|
||||
(function(){
|
||||
localfilesystem.getModuleFiles('WontExistModule');
|
||||
@@ -286,14 +260,7 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
return _join.apply(null,arguments);
|
||||
}));
|
||||
localfilesystem.init({
|
||||
|
||||
// events:{emit:function(eventName,dir){
|
||||
// eventName.should.equal("node-icon-dir");
|
||||
// dir.name.should.equal("TestNodeModule");
|
||||
// dir.icons.should.be.an.Array();
|
||||
// done();
|
||||
// }},
|
||||
settings:{coreNodesDir:moduleDir}
|
||||
coreNodesDir: moduleDir
|
||||
});
|
||||
var nodeModule = localfilesystem.getModuleFiles('TestNodeModule');
|
||||
nodeModule.should.have.property("TestNodeModule");
|
||||
|
Reference in New Issue
Block a user