mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge branch 'master' into dev
This commit is contained in:
@@ -61,7 +61,7 @@ describe("api/index", function() {
|
||||
should.not.exist(api.httpAdmin);
|
||||
done();
|
||||
});
|
||||
describe('initalises admin api without adminAuth', function(done) {
|
||||
describe('initalises admin api without adminAuth', function() {
|
||||
before(function() {
|
||||
beforeEach();
|
||||
api.init({},{},{},{});
|
||||
@@ -78,7 +78,7 @@ describe("api/index", function() {
|
||||
})
|
||||
});
|
||||
|
||||
describe('initalises admin api without editor', function(done) {
|
||||
describe('initalises admin api without editor', function() {
|
||||
before(function() {
|
||||
beforeEach();
|
||||
api.init({ disableEditor: true },{},{},{});
|
||||
@@ -95,7 +95,7 @@ describe("api/index", function() {
|
||||
})
|
||||
});
|
||||
|
||||
describe('initialises api with admin middleware', function(done) {
|
||||
describe('initialises api with admin middleware', function() {
|
||||
it('ignores non-function values',function(done) {
|
||||
api.init({ httpAdminRoot: true, httpAdminMiddleware: undefined },{},{},{});
|
||||
const middlewareFound = api.httpAdmin._router.stack.filter((layer) => layer.name === 'testMiddleware')
|
||||
@@ -112,7 +112,7 @@ describe("api/index", function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('initialises api with authentication enabled', function(done) {
|
||||
describe('initialises api with authentication enabled', function() {
|
||||
|
||||
it('enables an oauth/openID based authentication mechanism',function(done) {
|
||||
const stub = sinon.stub(apiAuth, 'genericStrategy').callsFake(function(){});
|
||||
@@ -135,7 +135,7 @@ describe("api/index", function() {
|
||||
|
||||
});
|
||||
|
||||
describe('initialises api with custom cors config', function (done) {
|
||||
describe('initialises api with custom cors config', function () {
|
||||
const httpAdminCors = {
|
||||
origin: "*",
|
||||
methods: "GET,PUT,POST,DELETE"
|
||||
@@ -156,7 +156,7 @@ describe("api/index", function() {
|
||||
})
|
||||
});
|
||||
|
||||
describe('editor start', function (done) {
|
||||
describe('editor start', function () {
|
||||
|
||||
it('cannot be started when editor is disabled', function (done) {
|
||||
const stub = sinon.stub(apiEditor, 'start').callsFake(function () {
|
||||
|
@@ -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"
|
||||
}
|
@@ -33,6 +33,11 @@ describe("runtime-api/diagnostics", function() {
|
||||
flowFile: "flows.json",
|
||||
mqttReconnectTime: 321,
|
||||
serialReconnectTime: 432,
|
||||
socketReconnectTime: 2222,
|
||||
socketTimeout: 3333,
|
||||
tcpMsgQueueSize: 4444,
|
||||
inboundWebSocketTimeout: 5555,
|
||||
runtimeState: {enabled: true, ui: false},
|
||||
adminAuth: {},//should be sanitised to "SET"
|
||||
httpAdminRoot: "/admin/root/",
|
||||
httpAdminCors: {},//should be sanitised to "SET"
|
||||
@@ -45,6 +50,7 @@ describe("runtime-api/diagnostics", function() {
|
||||
uiHost: "something.secret.com",//should be sanitised to "SET"
|
||||
uiPort: 1337,//should be sanitised to "SET"
|
||||
userDir: "/var/super/secret/",//should be sanitised to "SET",
|
||||
nodesDir: "/var/super/secret/",//should be sanitised to "SET",
|
||||
contextStorage: {
|
||||
default : { module: "memory" },
|
||||
file: { module: "localfilesystem" },
|
||||
@@ -73,8 +79,9 @@ describe("runtime-api/diagnostics", function() {
|
||||
|
||||
//result.runtime.xxxxx
|
||||
const runtimeCount = Object.keys(result.runtime).length;
|
||||
runtimeCount.should.eql(4);//ensure no more than 4 keys are present in runtime
|
||||
runtimeCount.should.eql(5);//ensure 5 keys are present in runtime
|
||||
result.runtime.should.have.property('isStarted',true)
|
||||
result.runtime.should.have.property('flows')
|
||||
result.runtime.should.have.property('modules').type("object");
|
||||
result.runtime.should.have.property('settings').type("object");
|
||||
result.runtime.should.have.property('version','7.7.7');
|
||||
@@ -87,7 +94,7 @@ describe("runtime-api/diagnostics", function() {
|
||||
|
||||
//result.runtime.settings.xxxxx
|
||||
const settingsCount = Object.keys(result.runtime.settings).length;
|
||||
settingsCount.should.eql(21);//ensure no more than the 21 settings listed below are present in the settings object
|
||||
settingsCount.should.eql(27);//ensure no more than the 21 settings listed below are present in the settings object
|
||||
result.runtime.settings.should.have.property('available',true);
|
||||
result.runtime.settings.should.have.property('apiMaxLength', "UNSET");//deliberately disabled to ensure UNSET is returned
|
||||
result.runtime.settings.should.have.property('debugMaxLength', 1111);
|
||||
@@ -96,6 +103,11 @@ describe("runtime-api/diagnostics", function() {
|
||||
result.runtime.settings.should.have.property('flowFile', "flows.json");
|
||||
result.runtime.settings.should.have.property('mqttReconnectTime', 321);
|
||||
result.runtime.settings.should.have.property('serialReconnectTime', 432);
|
||||
result.runtime.settings.should.have.property('socketReconnectTime', 2222);
|
||||
result.runtime.settings.should.have.property('socketTimeout', 3333);
|
||||
result.runtime.settings.should.have.property('tcpMsgQueueSize', 4444);
|
||||
result.runtime.settings.should.have.property('inboundWebSocketTimeout', 5555);
|
||||
result.runtime.settings.should.have.property('runtimeState', {enabled: true, ui: false});
|
||||
result.runtime.settings.should.have.property("adminAuth", "SET"); //should be sanitised to "SET"
|
||||
result.runtime.settings.should.have.property("httpAdminCors", "SET"); //should be sanitised to "SET"
|
||||
result.runtime.settings.should.have.property('httpAdminRoot', "/admin/root/");
|
||||
@@ -109,6 +121,7 @@ describe("runtime-api/diagnostics", function() {
|
||||
result.runtime.settings.should.have.property("uiPort", "SET"); //should be sanitised to "SET"
|
||||
result.runtime.settings.should.have.property("userDir", "SET"); //should be sanitised to "SET"
|
||||
result.runtime.settings.should.have.property('contextStorage').type("object");
|
||||
result.runtime.settings.should.have.property('nodesDir', "SET")
|
||||
|
||||
//result.runtime.settings.contextStorage.xxxxx
|
||||
const contextCount = Object.keys(result.runtime.settings.contextStorage).length;
|
||||
|
Reference in New Issue
Block a user