mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
add test for specific arrangement of node package
This commit is contained in:
parent
d6bb3a558f
commit
6a19d8246c
@ -329,17 +329,36 @@ describe("red/nodes/registry/localfilesystem",function() {
|
||||
localfilesystem.init({nodesDir:[nodesDir2]});
|
||||
const nodeModule = localfilesystem.getModuleFiles();
|
||||
const loaded = Object.keys(nodeModule)
|
||||
loaded.should.have.a.property("length", 3)
|
||||
loaded.indexOf('@test/testnode').should.greaterThan(-1, "Should load @test/testnode")
|
||||
loaded.indexOf('lower-case').should.greaterThan(-1, "Should load lower-case")
|
||||
loaded.indexOf('@lowercase/lower-case2').should.greaterThan(-1, "Should load @lowercase/lower-case2")
|
||||
loaded.indexOf('testnode2').should.greaterThan(-1, "Should load testnode2")
|
||||
loaded.indexOf('test-theme2').should.greaterThan(-1, "Should load test-theme2")
|
||||
loaded.should.have.a.property("length", 5)
|
||||
|
||||
// scoped module with nodes in same dir as package.json
|
||||
nodeModule['@test/testnode'].should.have.a.property('name','@test/testnode');
|
||||
nodeModule['@test/testnode'].should.have.a.property('version','1.0.0');
|
||||
nodeModule['@test/testnode'].should.have.a.property('nodes');
|
||||
nodeModule['@test/testnode'].should.have.a.property('path');
|
||||
nodeModule['@test/testnode'].should.have.a.property('user', false);
|
||||
|
||||
// node-red module with nodes in sub dir
|
||||
nodeModule['@lowercase/lower-case2'].should.have.a.property('name','@lowercase/lower-case2');
|
||||
nodeModule['@lowercase/lower-case2'].should.have.a.property('version','2.0.0');
|
||||
nodeModule['@lowercase/lower-case2'].should.have.a.property('nodes');
|
||||
nodeModule['@lowercase/lower-case2'].nodes.should.have.a.property('lower-case');
|
||||
nodeModule['@lowercase/lower-case2'].should.have.a.property('path');
|
||||
nodeModule['@lowercase/lower-case2'].should.have.a.property('user', false);
|
||||
|
||||
// scoped module with nodes in sub dir
|
||||
nodeModule['lower-case'].should.have.a.property('name', 'lower-case');
|
||||
nodeModule['lower-case'].should.have.a.property('version','1.0.0');
|
||||
nodeModule['lower-case'].should.have.a.property('nodes');
|
||||
nodeModule['lower-case'].nodes.should.have.a.property('lower-case');
|
||||
nodeModule['lower-case'].should.have.a.property('path');
|
||||
nodeModule['lower-case'].should.have.a.property('user', false);
|
||||
|
||||
nodeModule['testnode2'].should.have.a.property('name','testnode2');
|
||||
nodeModule['testnode2'].should.have.a.property('version','1.0.0');
|
||||
nodeModule['testnode2'].should.have.a.property('nodes');
|
||||
|
@ -0,0 +1,26 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('lower-case2',{
|
||||
category: 'function',
|
||||
color: '#a6bbcf',
|
||||
defaults: {
|
||||
name: {value:""}
|
||||
},
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
icon: "file.png",
|
||||
label: function() {
|
||||
return this.name||"lower-case2";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-template-name="lower-case2">
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="lower-case2">
|
||||
<p>A simple node that converts the message payloads into all lower-case2 characters</p>
|
||||
</script>
|
@ -0,0 +1,11 @@
|
||||
module.exports = function(RED) {
|
||||
function LowerCaseNode(config) {
|
||||
RED.nodes.createNode(this,config);
|
||||
var node = this;
|
||||
node.on('input', function(msg) {
|
||||
msg.payload = msg.payload.toLowerCase();
|
||||
node.send(msg);
|
||||
});
|
||||
}
|
||||
RED.nodes.registerType("lower-case2",LowerCaseNode);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name" : "@lowercase/lower-case2",
|
||||
"node-red" : {
|
||||
"nodes": {
|
||||
"lower-case": "lower-case2/lower-case.js"
|
||||
}
|
||||
},
|
||||
"version": "2.0.0"
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('lower-case',{
|
||||
category: 'function',
|
||||
color: '#a6bbcf',
|
||||
defaults: {
|
||||
name: {value:""}
|
||||
},
|
||||
inputs:1,
|
||||
outputs:1,
|
||||
icon: "file.png",
|
||||
label: function() {
|
||||
return this.name||"lower-case";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-template-name="lower-case">
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" data-help-name="lower-case">
|
||||
<p>A simple node that converts the message payloads into all lower-case characters</p>
|
||||
</script>
|
@ -0,0 +1,11 @@
|
||||
module.exports = function(RED) {
|
||||
function LowerCaseNode(config) {
|
||||
RED.nodes.createNode(this,config);
|
||||
var node = this;
|
||||
node.on('input', function(msg) {
|
||||
msg.payload = msg.payload.toLowerCase();
|
||||
node.send(msg);
|
||||
});
|
||||
}
|
||||
RED.nodes.registerType("lower-case",LowerCaseNode);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"name" : "lower-case",
|
||||
"node-red" : {
|
||||
"nodes": {
|
||||
"lower-case": "lower-case/lower-case.js"
|
||||
}
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
Loading…
Reference in New Issue
Block a user