mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fixup all the tests
This commit is contained in:
parent
998bf92ad4
commit
38a1291c5b
@ -42,7 +42,7 @@ module.exports = function(grunt) {
|
|||||||
reporter: 'spec'
|
reporter: 'spec'
|
||||||
},
|
},
|
||||||
all: { src: ['test/**/*_spec.js'] },
|
all: { src: ['test/**/*_spec.js'] },
|
||||||
core: { src: ["test/_spec.js","test/red/**/*_spec.js"]},
|
core: { src: ["test/_spec.js","test/unit/**/*_spec.js"]},
|
||||||
nodes: { src: ["test/nodes/**/*_spec.js"]}
|
nodes: { src: ["test/nodes/**/*_spec.js"]}
|
||||||
},
|
},
|
||||||
webdriver: {
|
webdriver: {
|
||||||
@ -59,8 +59,8 @@ module.exports = function(grunt) {
|
|||||||
reportFormats: ['lcov','html'],
|
reportFormats: ['lcov','html'],
|
||||||
print: 'both'
|
print: 'both'
|
||||||
},
|
},
|
||||||
all: { src: ["test/_spec.js","test/red/**/*_spec.js","test/nodes/**/*_spec.js"] },
|
all: { src: ["test/unit/_spec.js","test/unit/**/*_spec.js","test/nodes/**/*_spec.js"] },
|
||||||
core: { src: ["test/_spec.js","test/red/**/*_spec.js"]},
|
core: { src: ["test/unit/_spec.js","test/unit/**/*_spec.js"]},
|
||||||
nodes: { src: ["test/nodes/**/*_spec.js"]}
|
nodes: { src: ["test/nodes/**/*_spec.js"]}
|
||||||
},
|
},
|
||||||
jshint: {
|
jshint: {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red",
|
"name": "node-red",
|
||||||
"version": "0.19.1",
|
"version": "0.20.0",
|
||||||
"description": "A visual tool for wiring the Internet of Things",
|
"description": "A visual tool for wiring the Internet of Things",
|
||||||
"homepage": "http://nodered.org",
|
"homepage": "http://nodered.org",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
@ -116,9 +116,9 @@
|
|||||||
"wdio-mocha-framework": "^0.6.2",
|
"wdio-mocha-framework": "^0.6.2",
|
||||||
"wdio-spec-reporter": "^0.1.5",
|
"wdio-spec-reporter": "^0.1.5",
|
||||||
"webdriverio": "^4.13.1",
|
"webdriverio": "^4.13.1",
|
||||||
"node-red-node-test-helper": "^0.1.7"
|
"node-red-node-test-helper": "node-red/node-red-node-test-helper"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
packages/node_modules/@node-red/editor-api/lib/editor/ui.js
generated
vendored
5
packages/node_modules/@node-red/editor-api/lib/editor/ui.js
generated
vendored
@ -26,12 +26,13 @@ var theme = require("./theme");
|
|||||||
var runtimeAPI;
|
var runtimeAPI;
|
||||||
var editorClientDir = path.dirname(require.resolve("@node-red/editor-client"));
|
var editorClientDir = path.dirname(require.resolve("@node-red/editor-client"));
|
||||||
var defaultNodeIcon = path.join(editorClientDir,"public","red","images","icons","arrow-in.png");
|
var defaultNodeIcon = path.join(editorClientDir,"public","red","images","icons","arrow-in.png");
|
||||||
var editorTemplate = path.join(editorClientDir,"src","templates","index.mst");
|
var editorTemplatePath = path.join(editorClientDir,"src","templates","index.mst");
|
||||||
|
var editorTemplate;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
init: function(_runtimeAPI) {
|
init: function(_runtimeAPI) {
|
||||||
runtimeAPI = _runtimeAPI;
|
runtimeAPI = _runtimeAPI;
|
||||||
editorTemplate = fs.readFileSync(editorTemplate,"utf8");
|
editorTemplate = fs.readFileSync(editorTemplatePath,"utf8");
|
||||||
Mustache.parse(editorTemplate);
|
Mustache.parse(editorTemplate);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
2
packages/node_modules/node-red/package.json
generated
vendored
2
packages/node_modules/node-red/package.json
generated
vendored
@ -8,7 +8,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/node-red/node-red.git"
|
"url": "https://github.com/node-red/node-red.git"
|
||||||
},
|
},
|
||||||
"main": "red/red.js",
|
"main": "lib/red.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node red.js"
|
"start": "node red.js"
|
||||||
},
|
},
|
||||||
|
31
test/node_modules/nr-test-utils/index.js
generated
vendored
Normal file
31
test/node_modules/nr-test-utils/index.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
const path = require("path");
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
|
const PACKAGE_ROOT = "../../../packages/node_modules";
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
require: function(file) {
|
||||||
|
// console.log(path.join(__dirname,PACKAGE_ROOT,file))
|
||||||
|
return require(path.join(PACKAGE_ROOT,file));
|
||||||
|
},
|
||||||
|
resolve: function(file) {
|
||||||
|
return path.resolve(path.join(__dirname,PACKAGE_ROOT,file));
|
||||||
|
}
|
||||||
|
}
|
6
test/node_modules/nr-test-utils/package.json
generated
vendored
Normal file
6
test/node_modules/nr-test-utils/package.json
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "nr-test-utils",
|
||||||
|
"version": "0.20.0",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"private": true
|
||||||
|
}
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sentimentNode = require("../../../../nodes/core/analysis/72-sentiment.js");
|
var sentimentNode = require("nr-test-utils").require("@node-red/nodes/core/analysis/72-sentiment.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('sentiment Node', function() {
|
describe('sentiment Node', function() {
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var injectNode = require("../../../../nodes/core/core/20-inject.js");
|
var injectNode = require("nr-test-utils").require("@node-red/nodes/core/core/20-inject.js");
|
||||||
var Context = require("../../../../red/runtime/nodes/context");
|
var Context = require("nr-test-utils").require("@node-red/runtime/lib/nodes/context");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('inject node', function() {
|
describe('inject node', function() {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var catchNode = require("../../../../nodes/core/core/25-catch.js");
|
var catchNode = require("nr-test-utils").require("@node-red/nodes/core/core/25-catch.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('catch Node', function() {
|
describe('catch Node', function() {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var catchNode = require("../../../../nodes/core/core/25-status.js");
|
var catchNode = require("nr-test-utils").require("@node-red/nodes/core/core/25-status.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('status Node', function() {
|
describe('status Node', function() {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var debugNode = require("../../../../nodes/core/core/58-debug.js");
|
var debugNode = require("nr-test-utils").require("@node-red/nodes/core/core/58-debug.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var WebSocket = require('ws');
|
var WebSocket = require('ws');
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var linkNode = require("../../../../nodes/core/core/60-link.js");
|
var linkNode = require("nr-test-utils").require("@node-red/nodes/core/core/60-link.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('link Node', function() {
|
describe('link Node', function() {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var execNode = require("../../../../nodes/core/core/75-exec.js");
|
var execNode = require("nr-test-utils").require("@node-red/nodes/core/core/75-exec.js");
|
||||||
var osType = require("os").type();
|
var osType = require("os").type();
|
||||||
|
|
||||||
var child_process = require('child_process');
|
var child_process = require('child_process');
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var functionNode = require("../../../../nodes/core/core/80-function.js");
|
var functionNode = require("nr-test-utils").require("@node-red/nodes/core/core/80-function.js");
|
||||||
var Context = require("../../../../red/runtime/nodes/context");
|
var Context = require("nr-test-utils").require("@node-red/runtime/lib/nodes/context");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('function node', function() {
|
describe('function node', function() {
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var templateNode = require("../../../../nodes/core/core/80-template.js");
|
var templateNode = require("nr-test-utils").require("@node-red/nodes/core/core/80-template.js");
|
||||||
var Context = require("../../../../red/runtime/nodes/context");
|
var Context = require("nr-test-utils").require("@node-red/runtime/lib/nodes/context");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('template node', function() {
|
describe('template node', function() {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
|
|
||||||
var delayNode = require("../../../../nodes/core/core/89-delay.js");
|
var delayNode = require("nr-test-utils").require("@node-red/nodes/core/core/89-delay.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
var GRACE_PERCENTAGE=10;
|
var GRACE_PERCENTAGE=10;
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var triggerNode = require("../../../../nodes/core/core/89-trigger.js");
|
var triggerNode = require("nr-test-utils").require("@node-red/nodes/core/core/89-trigger.js");
|
||||||
var Context = require("../../../../red/runtime/nodes/context");
|
var Context = require("nr-test-utils").require("@node-red/runtime/lib/nodes/context");
|
||||||
var RED = require("../../../../red/red.js");
|
var RED = require("nr-test-utils").require("node-red/lib/red");
|
||||||
|
|
||||||
describe('trigger node', function() {
|
describe('trigger node', function() {
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var commentNode = require("../../../../nodes/core/core/90-comment.js");
|
var commentNode = require("nr-test-utils").require("@node-red/nodes/core/core/90-comment.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('comment Node', function() {
|
describe('comment Node', function() {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var unknown = require("../../../../nodes/core/core/98-unknown.js");
|
var unknown = require("nr-test-utils").require("@node-red/nodes/core/core/98-unknown.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('unknown Node', function() {
|
describe('unknown Node', function() {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var rpi = require("../../../../nodes/core/hardware/36-rpi-gpio.js");
|
var rpi = require("nr-test-utils").require("@node-red/nodes/core/hardware/36-rpi-gpio.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
|
||||||
|
@ -22,12 +22,12 @@ var express = require("express");
|
|||||||
var bodyParser = require('body-parser');
|
var bodyParser = require('body-parser');
|
||||||
var stoppable = require('stoppable');
|
var stoppable = require('stoppable');
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var httpRequestNode = require("../../../../nodes/core/io/21-httprequest.js");
|
var httpRequestNode = require("nr-test-utils").require("@node-red/nodes/core/io/21-httprequest.js");
|
||||||
var tlsNode = require("../../../../nodes/core/io/05-tls.js");
|
var tlsNode = require("nr-test-utils").require("@node-red/nodes/core/io/05-tls.js");
|
||||||
var hashSum = require("hash-sum");
|
var hashSum = require("hash-sum");
|
||||||
var httpProxy = require('http-proxy');
|
var httpProxy = require('http-proxy');
|
||||||
var cookieParser = require('cookie-parser');
|
var cookieParser = require('cookie-parser');
|
||||||
var RED = require("../../../../red/red.js");
|
var RED = require("nr-test-utils").require("node-red/lib/red");
|
||||||
var fs = require('fs-extra');
|
var fs = require('fs-extra');
|
||||||
var auth = require('basic-auth');
|
var auth = require('basic-auth');
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ var ws = require("ws");
|
|||||||
var when = require("when");
|
var when = require("when");
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var websocketNode = require("../../../../nodes/core/io/22-websocket.js");
|
var websocketNode = require("nr-test-utils").require("@node-red/nodes/core/io/22-websocket.js");
|
||||||
|
|
||||||
var sockets = [];
|
var sockets = [];
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ var fs = require("fs-extra");
|
|||||||
var path = require("path");
|
var path = require("path");
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var watchNode = require("../../../../nodes/core/io/23-watch.js");
|
var watchNode = require("nr-test-utils").require("@node-red/nodes/core/io/23-watch.js");
|
||||||
|
|
||||||
|
|
||||||
describe('watch Node', function() {
|
describe('watch Node', function() {
|
||||||
|
@ -19,7 +19,7 @@ var should = require("should");
|
|||||||
var stoppable = require('stoppable');
|
var stoppable = require('stoppable');
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
var tcpinNode = require("../../../../nodes/core/io/31-tcpin.js");
|
var tcpinNode = require("nr-test-utils").require("@node-red/nodes/core/io/31-tcpin.js");
|
||||||
|
|
||||||
|
|
||||||
describe('TCP in Node', function() {
|
describe('TCP in Node', function() {
|
||||||
|
@ -18,8 +18,8 @@ var net = require("net");
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var stoppable = require('stoppable');
|
var stoppable = require('stoppable');
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var tcpinNode = require("../../../../nodes/core/io/31-tcpin.js");
|
var tcpinNode = require("nr-test-utils").require("@node-red/nodes/core/io/31-tcpin.js");
|
||||||
const RED = require("../../../../red/red.js");
|
var RED = require("nr-test-utils").require("node-red/lib/red.js");
|
||||||
|
|
||||||
|
|
||||||
describe('TCP Request Node', function() {
|
describe('TCP Request Node', function() {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
var dgram = require("dgram");
|
var dgram = require("dgram");
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var udpNode = require("../../../../nodes/core/io/32-udp.js");
|
var udpNode = require("nr-test-utils").require("@node-red/nodes/core/io/32-udp.js");
|
||||||
|
|
||||||
|
|
||||||
describe('UDP in Node', function() {
|
describe('UDP in Node', function() {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
var dgram = require("dgram");
|
var dgram = require("dgram");
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var udpNode = require("../../../../nodes/core/io/32-udp.js");
|
var udpNode = require("nr-test-utils").require("@node-red/nodes/core/io/32-udp.js");
|
||||||
|
|
||||||
|
|
||||||
describe('UDP out Node', function() {
|
describe('UDP out Node', function() {
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
|
|
||||||
var switchNode = require("../../../../nodes/core/logic/10-switch.js");
|
var switchNode = require("nr-test-utils").require("@node-red/nodes/core/logic/10-switch.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var RED = require("../../../../red/red.js");
|
var RED = require("nr-test-utils").require("node-red/lib/red");
|
||||||
var Context = require("../../../../red/runtime/nodes/context");
|
var Context = require("nr-test-utils").require("@node-red/runtime/lib/nodes/context/");
|
||||||
|
|
||||||
describe('switch Node', function() {
|
describe('switch Node', function() {
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
|
|
||||||
var changeNode = require("../../../../nodes/core/logic/15-change.js");
|
var changeNode = require("nr-test-utils").require("@node-red/nodes/core/logic/15-change.js");
|
||||||
var Context = require("../../../../red/runtime/nodes/context");
|
var Context = require("nr-test-utils").require("@node-red/runtime/lib/nodes/context");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('change Node', function() {
|
describe('change Node', function() {
|
||||||
@ -569,19 +569,14 @@ describe('change Node', function() {
|
|||||||
helper.load(changeNode, flow, function() {
|
helper.load(changeNode, flow, function() {
|
||||||
var changeNode1 = helper.getNode("changeNode1");
|
var changeNode1 = helper.getNode("changeNode1");
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
sinon.spy(changeNode1,"error");
|
|
||||||
helperNode1.on("input", function(msg) {
|
helperNode1.on("input", function(msg) {
|
||||||
done("Invalid jsonata expression passed message through");
|
done("Invalid jsonata expression passed message through");
|
||||||
});
|
});
|
||||||
changeNode1.receive({payload:"Hello World!"});
|
changeNode1.on("call:error", function(err) {
|
||||||
setTimeout(function() {
|
// Expect error to be called
|
||||||
try {
|
|
||||||
changeNode1.error.called.should.be.true();
|
|
||||||
done();
|
done();
|
||||||
} catch(err) {
|
});
|
||||||
done(err);
|
changeNode1.receive({payload:"Hello World!"});
|
||||||
}
|
|
||||||
},50);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
|
|
||||||
var rangeNode = require("../../../../nodes/core/logic/16-range.js");
|
var rangeNode = require("nr-test-utils").require("@node-red/nodes/core/logic/16-range.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('range Node', function() {
|
describe('range Node', function() {
|
||||||
@ -131,9 +131,8 @@ describe('range Node', function() {
|
|||||||
helper.load(rangeNode, flow, function() {
|
helper.load(rangeNode, flow, function() {
|
||||||
var rangeNode1 = helper.getNode("rangeNode1");
|
var rangeNode1 = helper.getNode("rangeNode1");
|
||||||
var helperNode1 = helper.getNode("helperNode1");
|
var helperNode1 = helper.getNode("helperNode1");
|
||||||
|
rangeNode1.on("call:log",function(args) {
|
||||||
var sinon = require('sinon');
|
var log = args.args[0];
|
||||||
sinon.stub(rangeNode1, 'log', function(log) {
|
|
||||||
if (log.indexOf("notnumber") > -1) {
|
if (log.indexOf("notnumber") > -1) {
|
||||||
rangeNode1.log.restore();
|
rangeNode1.log.restore();
|
||||||
done();
|
done();
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var splitNode = require("../../../../nodes/core/logic/17-split.js");
|
var splitNode = require("nr-test-utils").require("@node-red/nodes/core/logic/17-split.js");
|
||||||
var joinNode = require("../../../../nodes/core/logic/17-split.js");
|
var joinNode = require("nr-test-utils").require("@node-red/nodes/core/logic/17-split.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var RED = require("../../../../red/red.js");
|
var RED = require("nr-test-utils").require("node-red/lib/red.js");
|
||||||
var Context = require("../../../../red/runtime/nodes/context");
|
var Context = require("nr-test-utils").require("@node-red/runtime/lib/nodes/context");
|
||||||
|
|
||||||
var TimeoutForErrorCase = 20;
|
var TimeoutForErrorCase = 20;
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sortNode = require("../../../../nodes/core/logic/18-sort.js");
|
var sortNode = require("nr-test-utils").require("@node-red/nodes/core/logic/18-sort.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var RED = require("../../../../red/red.js");
|
var RED = require("nr-test-utils").require("node-red/lib/red.js");
|
||||||
var Context = require("../../../../red/runtime/nodes/context");
|
var Context = require("nr-test-utils").require("@node-red/runtime/lib/nodes/context");
|
||||||
|
|
||||||
describe('SORT node', function() {
|
describe('SORT node', function() {
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var batchNode = require("../../../../nodes/core/logic/19-batch.js");
|
var batchNode = require("nr-test-utils").require("@node-red/nodes/core/logic/19-batch.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
var RED = require("../../../../red/red.js");
|
var RED = require("nr-test-utils").require("node-red/lib/red.js");
|
||||||
|
|
||||||
describe('BATCH node', function() {
|
describe('BATCH node', function() {
|
||||||
this.timeout(8000);
|
this.timeout(8000);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var csvNode = require("../../../../nodes/core/parsers/70-CSV.js");
|
var csvNode = require("nr-test-utils").require("@node-red/nodes/core/parsers/70-CSV.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('CSV node', function() {
|
describe('CSV node', function() {
|
||||||
|
@ -18,7 +18,7 @@ var should = require("should");
|
|||||||
var path = require("path");
|
var path = require("path");
|
||||||
var fs = require('fs-extra');
|
var fs = require('fs-extra');
|
||||||
|
|
||||||
var htmlNode = require("../../../../nodes/core/parsers/70-HTML.js");
|
var htmlNode = require("nr-test-utils").require("@node-red/nodes/core/parsers/70-HTML.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('html node', function() {
|
describe('html node', function() {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var jsonNode = require("../../../../nodes/core/parsers/70-JSON.js");
|
var jsonNode = require("nr-test-utils").require("@node-red/nodes/core/parsers/70-JSON.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('JSON node', function() {
|
describe('JSON node', function() {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var xmlNode = require("../../../../nodes/core/parsers/70-XML.js");
|
var xmlNode = require("nr-test-utils").require("@node-red/nodes/core/parsers/70-XML.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('XML node', function() {
|
describe('XML node', function() {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var yamlNode = require("../../../../nodes/core/parsers/70-YAML.js");
|
var yamlNode = require("nr-test-utils").require("@node-red/nodes/core/parsers/70-YAML.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('YAML node', function() {
|
describe('YAML node', function() {
|
||||||
|
@ -19,7 +19,7 @@ var path = require('path');
|
|||||||
var os = require('os');
|
var os = require('os');
|
||||||
var fs = require('fs-extra');
|
var fs = require('fs-extra');
|
||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
var tailNode = require("../../../../nodes/core/storage/28-tail.js");
|
var tailNode = require("nr-test-utils").require("@node-red/nodes/core/storage/28-tail.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('tail Node', function() {
|
describe('tail Node', function() {
|
||||||
|
@ -19,7 +19,7 @@ var path = require('path');
|
|||||||
var fs = require('fs-extra');
|
var fs = require('fs-extra');
|
||||||
var os = require('os');
|
var os = require('os');
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var fileNode = require("../../../../nodes/core/storage/50-file.js");
|
var fileNode = require("nr-test-utils").require("@node-red/nodes/core/storage/50-file.js");
|
||||||
var helper = require("node-red-node-test-helper");
|
var helper = require("node-red-node-test-helper");
|
||||||
|
|
||||||
describe('file Nodes', function() {
|
describe('file Nodes', function() {
|
||||||
|
@ -21,9 +21,11 @@ var bodyParser = require('body-parser');
|
|||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
var when = require('when');
|
var when = require('when');
|
||||||
|
|
||||||
var context = require("../../../../red/api/admin/context");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var Context = require("../../../../red/runtime/nodes/context");
|
|
||||||
var Util = require("../../../../red/runtime/util");
|
var context = NR_TEST_UTILS.require("@node-red/editor-api/lib/admin/context");
|
||||||
|
// var Context = require("../../../../red/runtime/nodes/context");
|
||||||
|
// var Util = require("../../../../red/runtime/util");
|
||||||
|
|
||||||
describe("api/admin/context", function() {
|
describe("api/admin/context", function() {
|
||||||
it.skip("NEEDS TESTS WRITING",function() {});
|
it.skip("NEEDS TESTS WRITING",function() {});
|
||||||
|
@ -21,7 +21,9 @@ var bodyParser = require('body-parser');
|
|||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
var when = require('when');
|
var when = require('when');
|
||||||
|
|
||||||
var flow = require("../../../../red/api/admin/flow");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var flow = NR_TEST_UTILS.require("@node-red/editor-api/lib/admin/flow");
|
||||||
|
|
||||||
describe("api/admin/flow", function() {
|
describe("api/admin/flow", function() {
|
||||||
|
|
||||||
|
@ -20,7 +20,9 @@ var express = require('express');
|
|||||||
var bodyParser = require('body-parser');
|
var bodyParser = require('body-parser');
|
||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
|
|
||||||
var flows = require("../../../../red/api/admin/flows");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var flows = NR_TEST_UTILS.require("@node-red/editor-api/lib/admin/flows");
|
||||||
|
|
||||||
describe("api/admin/flows", function() {
|
describe("api/admin/flows", function() {
|
||||||
|
|
||||||
|
@ -18,12 +18,14 @@ var should = require("should");
|
|||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var request = require("supertest");
|
var request = require("supertest");
|
||||||
var express = require("express");
|
var express = require("express");
|
||||||
var adminApi = require("../../../../red/api/admin");
|
|
||||||
var auth = require("../../../../red/api/auth");
|
|
||||||
|
|
||||||
var nodes = require("../../../../red/api/admin/nodes");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var flows = require("../../../../red/api/admin/flows");
|
|
||||||
var flow = require("../../../../red/api/admin/flow");
|
var adminApi = NR_TEST_UTILS.require("@node-red/editor-api/lib/admin");
|
||||||
|
var auth = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth");
|
||||||
|
var nodes = NR_TEST_UTILS.require("@node-red/editor-api/lib/admin/nodes");
|
||||||
|
var flows = NR_TEST_UTILS.require("@node-red/editor-api/lib/admin/flows");
|
||||||
|
var flow = NR_TEST_UTILS.require("@node-red/editor-api/lib/admin/flow");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure all API routes are correctly mounted, with the expected permissions checks
|
* Ensure all API routes are correctly mounted, with the expected permissions checks
|
||||||
|
@ -21,8 +21,10 @@ var bodyParser = require('body-parser');
|
|||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
var when = require('when');
|
var when = require('when');
|
||||||
|
|
||||||
var nodes = require("../../../../red/api/admin/nodes");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var apiUtil = require("../../../../red/api/util");
|
|
||||||
|
var nodes = NR_TEST_UTILS.require("@node-red/editor-api/lib/admin/nodes");
|
||||||
|
var apiUtil = NR_TEST_UTILS.require("@node-red/editor-api/lib/util");
|
||||||
|
|
||||||
describe("api/admin/nodes", function() {
|
describe("api/admin/nodes", function() {
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var Clients = require("../../../../red/api/auth/clients");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var Clients = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/clients");
|
||||||
|
|
||||||
describe("api/auth/clients", function() {
|
describe("api/auth/clients", function() {
|
||||||
it('finds the known editor client',function(done) {
|
it('finds the known editor client',function(done) {
|
||||||
|
@ -20,10 +20,12 @@ var sinon = require("sinon");
|
|||||||
|
|
||||||
var passport = require("passport");
|
var passport = require("passport");
|
||||||
|
|
||||||
var auth = require("../../../../red/api/auth");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var Users = require("../../../../red/api/auth/users");
|
|
||||||
var Tokens = require("../../../../red/api/auth/tokens");
|
var auth = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth");
|
||||||
var Permissions = require("../../../../red/api/auth/permissions");
|
var Users = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/users");
|
||||||
|
var Tokens = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/tokens");
|
||||||
|
var Permissions = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/permissions");
|
||||||
|
|
||||||
describe("api/auth/index",function() {
|
describe("api/auth/index",function() {
|
||||||
|
|
||||||
|
@ -15,7 +15,10 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var permissions = require("../../../../red/api/auth/permissions");
|
|
||||||
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var permissions = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/permissions");
|
||||||
|
|
||||||
describe("api/auth/permissions", function() {
|
describe("api/auth/permissions", function() {
|
||||||
describe("hasPermission", function() {
|
describe("hasPermission", function() {
|
||||||
|
@ -18,10 +18,12 @@ var should = require("should");
|
|||||||
var when = require('when');
|
var when = require('when');
|
||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
|
|
||||||
var strategies = require("../../../../red/api/auth/strategies");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var Users = require("../../../../red/api/auth/users");
|
|
||||||
var Tokens = require("../../../../red/api/auth/tokens");
|
var strategies = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/strategies");
|
||||||
var Clients = require("../../../../red/api/auth/clients");
|
var Users = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/users");
|
||||||
|
var Tokens = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/tokens");
|
||||||
|
var Clients = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/clients");
|
||||||
|
|
||||||
describe("api/auth/strategies", function() {
|
describe("api/auth/strategies", function() {
|
||||||
describe("Password Token Exchange", function() {
|
describe("Password Token Exchange", function() {
|
||||||
|
@ -18,7 +18,9 @@ var should = require("should");
|
|||||||
var when = require("when");
|
var when = require("when");
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
|
|
||||||
var Tokens = require("../../../../red/api/auth/tokens");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var Tokens = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/tokens");
|
||||||
|
|
||||||
|
|
||||||
describe("api/auth/tokens", function() {
|
describe("api/auth/tokens", function() {
|
||||||
|
@ -18,7 +18,9 @@ var should = require("should");
|
|||||||
var when = require('when');
|
var when = require('when');
|
||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
|
|
||||||
var Users = require("../../../../red/api/auth/users");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var Users = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/users");
|
||||||
|
|
||||||
describe("api/auth/users", function() {
|
describe("api/auth/users", function() {
|
||||||
after(function() {
|
after(function() {
|
||||||
|
@ -24,9 +24,11 @@ var express = require('express');
|
|||||||
var app = express();
|
var app = express();
|
||||||
var WebSocket = require('ws');
|
var WebSocket = require('ws');
|
||||||
|
|
||||||
var comms = require("../../../../red/api/editor/comms");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var Users = require("../../../../red/api/auth/users");
|
|
||||||
var Tokens = require("../../../../red/api/auth/tokens");
|
var comms = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/comms");
|
||||||
|
var Users = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/users");
|
||||||
|
var Tokens = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth/tokens");
|
||||||
|
|
||||||
var address = '127.0.0.1';
|
var address = '127.0.0.1';
|
||||||
var listenPort = 0; // use ephemeral port
|
var listenPort = 0; // use ephemeral port
|
||||||
|
@ -20,7 +20,9 @@ var express = require('express');
|
|||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
var when = require('when');
|
var when = require('when');
|
||||||
|
|
||||||
var credentials = require("../../../../red/api/editor/credentials");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var credentials = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/credentials");
|
||||||
|
|
||||||
describe('api/editor/credentials', function() {
|
describe('api/editor/credentials', function() {
|
||||||
var app;
|
var app;
|
||||||
|
@ -18,12 +18,15 @@ var should = require("should");
|
|||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var request = require("supertest");
|
var request = require("supertest");
|
||||||
var express = require("express");
|
var express = require("express");
|
||||||
var editorApi = require("../../../../red/api/editor");
|
|
||||||
var comms = require("../../../../red/api/editor/comms");
|
|
||||||
var info = require("../../../../red/api/editor/settings");
|
|
||||||
var auth = require("../../../../red/api/auth");
|
|
||||||
|
|
||||||
var log = require("../../../../red/util/log");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var editorApi = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor");
|
||||||
|
var comms = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/comms");
|
||||||
|
var info = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/settings");
|
||||||
|
var auth = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth");
|
||||||
|
|
||||||
|
var log = NR_TEST_UTILS.require("@node-red/util").log;
|
||||||
|
|
||||||
|
|
||||||
var when = require("when");
|
var when = require("when");
|
||||||
@ -59,15 +62,15 @@ describe("api/editor/index", function() {
|
|||||||
return function(req,res,next) { next(); }
|
return function(req,res,next) { next(); }
|
||||||
});
|
});
|
||||||
mockList.forEach(function(m) {
|
mockList.forEach(function(m) {
|
||||||
sinon.stub(require("../../../../red/api/editor/"+m),"init",function(){});
|
sinon.stub(NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/"+m),"init",function(){});
|
||||||
});
|
});
|
||||||
sinon.stub(require("../../../../red/api/editor/theme"),"app",function(){ return express()});
|
sinon.stub(NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/theme"),"app",function(){ return express()});
|
||||||
});
|
});
|
||||||
after(function() {
|
after(function() {
|
||||||
mockList.forEach(function(m) {
|
mockList.forEach(function(m) {
|
||||||
require("../../../../red/api/editor/"+m).init.restore();
|
NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/"+m).init.restore();
|
||||||
})
|
})
|
||||||
require("../../../../red/api/editor/theme").app.restore();
|
NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/theme").app.restore();
|
||||||
auth.needsPermission.restore();
|
auth.needsPermission.restore();
|
||||||
log.error.restore();
|
log.error.restore();
|
||||||
});
|
});
|
||||||
@ -93,9 +96,12 @@ describe("api/editor/index", function() {
|
|||||||
});
|
});
|
||||||
it('serves icons', function(done) {
|
it('serves icons', function(done) {
|
||||||
request(app)
|
request(app)
|
||||||
.get("/icons/inject.png")
|
.get("/red/images/icons/node-changed.png")
|
||||||
|
.expect(200)
|
||||||
.expect("Content-Type", /image\/png/)
|
.expect("Content-Type", /image\/png/)
|
||||||
.expect(200,done)
|
.end(function(err,res) {
|
||||||
|
done(err);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
it('handles page not there', function(done) {
|
it('handles page not there', function(done) {
|
||||||
request(app)
|
request(app)
|
||||||
|
@ -20,9 +20,11 @@ var request = require('supertest');
|
|||||||
var express = require('express');
|
var express = require('express');
|
||||||
var bodyParser = require('body-parser');
|
var bodyParser = require('body-parser');
|
||||||
|
|
||||||
var app;
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
var library = require("../../../../red/api/editor/library");
|
var library = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/library");
|
||||||
|
|
||||||
|
var app;
|
||||||
|
|
||||||
describe("api/editor/library", function() {
|
describe("api/editor/library", function() {
|
||||||
|
|
||||||
|
@ -19,8 +19,10 @@ var request = require('supertest');
|
|||||||
var express = require('express');
|
var express = require('express');
|
||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
|
|
||||||
var locales = require("../../../../red/api/editor/locales");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var i18n = require("../../../../red/util").i18n;
|
|
||||||
|
var locales = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/locales");
|
||||||
|
var i18n = NR_TEST_UTILS.require("@node-red/util").i18n;
|
||||||
|
|
||||||
describe("api/editor/locales", function() {
|
describe("api/editor/locales", function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
describe("api/editor/projects", function() {
|
describe("api/editor/projects", function() {
|
||||||
it.skip("NEEDS TESTS WRITING",function() {});
|
it.skip("NEEDS TESTS WRITING",function() {});
|
||||||
});
|
});
|
||||||
|
@ -21,8 +21,11 @@ var bodyParser = require("body-parser");
|
|||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
|
|
||||||
var app;
|
var app;
|
||||||
var info = require("../../../../red/api/editor/settings");
|
|
||||||
var theme = require("../../../../red/api/editor/theme");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var info = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/settings");
|
||||||
|
var theme = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/theme");
|
||||||
|
|
||||||
describe("api/editor/settings", function() {
|
describe("api/editor/settings", function() {
|
||||||
before(function() {
|
before(function() {
|
||||||
|
@ -18,7 +18,8 @@ var should = require("should");
|
|||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var request = require("supertest");
|
var request = require("supertest");
|
||||||
var express = require("express");
|
var express = require("express");
|
||||||
var sshkeys = require("../../../../red/api/editor/sshkeys");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var sshkeys = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/sshkeys");
|
||||||
var bodyParser = require("body-parser");
|
var bodyParser = require("body-parser");
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,9 @@ var fs = require("fs");
|
|||||||
|
|
||||||
var app = express();
|
var app = express();
|
||||||
|
|
||||||
var theme = require("../../../../red/api/editor/theme");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var theme = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/theme");
|
||||||
|
|
||||||
describe("api/editor/theme", function() {
|
describe("api/editor/theme", function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
@ -20,7 +20,9 @@ var express = require("express");
|
|||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
|
|
||||||
var ui = require("../../../../red/api/editor/ui");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var ui = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor/ui");
|
||||||
|
|
||||||
|
|
||||||
describe("api/editor/ui", function() {
|
describe("api/editor/ui", function() {
|
||||||
@ -31,7 +33,7 @@ describe("api/editor/ui", function() {
|
|||||||
nodes: {
|
nodes: {
|
||||||
getIcon: function(opts) {
|
getIcon: function(opts) {
|
||||||
return new Promise(function(resolve,reject) {
|
return new Promise(function(resolve,reject) {
|
||||||
fs.readFile(path.resolve(__dirname+'/../../../../public/icons/arrow-in.png'), function(err,data) {
|
fs.readFile(NR_TEST_UTILS.resolve("@node-red/editor-client/src/images/icons/arrow-in.png"), function(err,data) {
|
||||||
resolve(data);
|
resolve(data);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@ -92,7 +94,7 @@ describe("api/editor/ui", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
it('returns the requested icon', function(done) {
|
it('returns the requested icon', function(done) {
|
||||||
var defaultIcon = fs.readFileSync(path.resolve(__dirname+'/../../../../public/icons/arrow-in.png'));
|
var defaultIcon = fs.readFileSync(NR_TEST_UTILS.resolve("@node-red/editor-client/src/images/icons/arrow-in.png"));
|
||||||
request(app)
|
request(app)
|
||||||
.get("/icons/module/icon.png")
|
.get("/icons/module/icon.png")
|
||||||
.expect("Content-Type", /image\/png/)
|
.expect("Content-Type", /image\/png/)
|
||||||
|
@ -21,11 +21,14 @@ var express = require("express");
|
|||||||
var when = require("when");
|
var when = require("when");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var api = require("../../../red/api");
|
|
||||||
|
|
||||||
var apiAuth = require("../../../red/api/auth");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var apiEditor = require("../../../red/api/editor");
|
|
||||||
var apiAdmin = require("../../../red/api/admin");
|
var api = NR_TEST_UTILS.require("@node-red/editor-api");
|
||||||
|
|
||||||
|
var apiAuth = NR_TEST_UTILS.require("@node-red/editor-api/lib/auth");
|
||||||
|
var apiEditor = NR_TEST_UTILS.require("@node-red/editor-api/lib/editor");
|
||||||
|
var apiAdmin = NR_TEST_UTILS.require("@node-red/editor-api/lib/admin");
|
||||||
|
|
||||||
|
|
||||||
describe("api/index", function() {
|
describe("api/index", function() {
|
||||||
|
@ -19,12 +19,12 @@ var sinon = require("sinon");
|
|||||||
var request = require('supertest');
|
var request = require('supertest');
|
||||||
var express = require('express');
|
var express = require('express');
|
||||||
|
|
||||||
var apiUtil = require("../../../red/api/util");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
var log = require("../../../red/util").log; // TODO: separate module
|
|
||||||
var i18n = require("../../../red/util").i18n; // TODO: separate module
|
|
||||||
|
|
||||||
|
var apiUtil = NR_TEST_UTILS.require("@node-red/editor-api/lib/util");
|
||||||
|
|
||||||
|
var log = NR_TEST_UTILS.require("@node-red/util").log;
|
||||||
|
var i18n = NR_TEST_UTILS.require("@node-red/util").i18n;
|
||||||
|
|
||||||
describe("api/util", function() {
|
describe("api/util", function() {
|
||||||
describe("errorHandler", function() {
|
describe("errorHandler", function() {
|
||||||
|
@ -16,7 +16,9 @@
|
|||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
|
|
||||||
var deprecated = require("../../../red/runtime-registry/deprecated.js");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var deprecated = NR_TEST_UTILS.require("@node-red/registry/lib/deprecated.js");
|
||||||
|
|
||||||
describe('deprecated', function() {
|
describe('deprecated', function() {
|
||||||
it('should return info on a node',function() {
|
it('should return info on a node',function() {
|
||||||
|
@ -20,11 +20,13 @@ var path = require("path");
|
|||||||
var when = require("when");
|
var when = require("when");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
|
||||||
var registry = require("../../../red/runtime-registry");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
var installer = require("../../../red/runtime-registry/installer");
|
var registry = NR_TEST_UTILS.require("@node-red/registry");
|
||||||
var loader = require("../../../red/runtime-registry/loader");
|
|
||||||
var typeRegistry = require("../../../red/runtime-registry/registry");
|
var installer = NR_TEST_UTILS.require("@node-red/registry/lib/installer");
|
||||||
|
var loader = NR_TEST_UTILS.require("@node-red/registry/lib/loader");
|
||||||
|
var typeRegistry = NR_TEST_UTILS.require("@node-red/registry/lib/registry");
|
||||||
|
|
||||||
describe('red/registry/index', function() {
|
describe('red/registry/index', function() {
|
||||||
var stubs = [];
|
var stubs = [];
|
||||||
|
@ -22,9 +22,13 @@ var fs = require('fs');
|
|||||||
var EventEmitter = require('events');
|
var EventEmitter = require('events');
|
||||||
|
|
||||||
var child_process = require('child_process');
|
var child_process = require('child_process');
|
||||||
var installer = require("../../../red/runtime-registry/installer");
|
|
||||||
var registry = require("../../../red/runtime-registry/index");
|
|
||||||
var typeRegistry = require("../../../red/runtime-registry/registry");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var installer = NR_TEST_UTILS.require("@node-red/registry/lib/installer");
|
||||||
|
var registry = NR_TEST_UTILS.require("@node-red/registry/lib/index");
|
||||||
|
var typeRegistry = NR_TEST_UTILS.require("@node-red/registry/lib/registry");
|
||||||
|
|
||||||
describe('nodes/registry/installer', function() {
|
describe('nodes/registry/installer', function() {
|
||||||
|
|
||||||
|
@ -19,7 +19,9 @@ var should = require("should");
|
|||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
|
|
||||||
var library = require("../../../red/runtime-registry/library");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var library = NR_TEST_UTILS.require("@node-red/registry/lib/library");
|
||||||
|
|
||||||
describe("library api", function() {
|
describe("library api", function() {
|
||||||
it('returns null list when no modules have been registered', function() {
|
it('returns null list when no modules have been registered', function() {
|
||||||
|
@ -20,12 +20,14 @@ var sinon = require("sinon");
|
|||||||
var path = require("path");
|
var path = require("path");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
|
||||||
var loader = require("../../../red/runtime-registry/loader");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
var localfilesystem = require("../../../red/runtime-registry/localfilesystem");
|
var loader = NR_TEST_UTILS.require("@node-red/registry/lib/loader");
|
||||||
var registry = require("../../../red/runtime-registry/registry");
|
|
||||||
|
|
||||||
var nodes = require("../../../red/runtime-registry");
|
var localfilesystem = NR_TEST_UTILS.require("@node-red/registry/lib/localfilesystem");
|
||||||
|
var registry = NR_TEST_UTILS.require("@node-red/registry/lib/registry");
|
||||||
|
|
||||||
|
var nodes = NR_TEST_UTILS.require("@node-red/registry");
|
||||||
|
|
||||||
var resourcesDir = path.resolve(path.join(__dirname,"resources","local"));
|
var resourcesDir = path.resolve(path.join(__dirname,"resources","local"));
|
||||||
|
|
||||||
|
@ -19,13 +19,15 @@ var when = require("when");
|
|||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
|
|
||||||
var localfilesystem = require("../../../red/runtime-registry/localfilesystem");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var localfilesystem = NR_TEST_UTILS.require("@node-red/registry/lib/localfilesystem");
|
||||||
|
|
||||||
var resourcesDir = path.resolve(path.join(__dirname,"resources","local"));
|
var resourcesDir = path.resolve(path.join(__dirname,"resources","local"));
|
||||||
var userDir = path.resolve(path.join(__dirname,"resources","userDir"));
|
var userDir = path.resolve(path.join(__dirname,"resources","userDir"));
|
||||||
var moduleDir = path.resolve(path.join(__dirname,"resources","local","TestNodeModule"));
|
var moduleDir = path.resolve(path.join(__dirname,"resources","local","TestNodeModule"));
|
||||||
|
|
||||||
var i18n = require("../../../red/util").i18n; // TODO: separate module
|
var i18n = NR_TEST_UTILS.require("@node-red/util").i18n;
|
||||||
|
|
||||||
describe("red/nodes/registry/localfilesystem",function() {
|
describe("red/nodes/registry/localfilesystem",function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
@ -108,7 +110,8 @@ describe("red/nodes/registry/localfilesystem",function() {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
it("Finds nodes in settings.nodesDir (string,relative path)",function(done) {
|
it("Finds nodes in settings.nodesDir (string,relative path)",function(done) {
|
||||||
var relativeUserDir = path.join("test","red","runtime-registry","resources","userDir");
|
var relativeUserDir = path.join("test","unit","@node-red","registry","lib","resources","userDir");
|
||||||
|
console.log(relativeUserDir)
|
||||||
localfilesystem.init({settings:{nodesDir:relativeUserDir}});
|
localfilesystem.init({settings:{nodesDir:relativeUserDir}});
|
||||||
var nodeList = localfilesystem.getNodeFiles(true);
|
var nodeList = localfilesystem.getNodeFiles(true);
|
||||||
nodeList.should.have.a.property("node-red");
|
nodeList.should.have.a.property("node-red");
|
||||||
@ -186,11 +189,11 @@ describe("red/nodes/registry/localfilesystem",function() {
|
|||||||
var list = localfilesystem.getNodeFiles(true);
|
var list = localfilesystem.getNodeFiles(true);
|
||||||
list.should.have.property("node-red");
|
list.should.have.property("node-red");
|
||||||
list["node-red"].should.have.property("icons");
|
list["node-red"].should.have.property("icons");
|
||||||
list["node-red"].icons.should.have.length(2);
|
list["node-red"].icons.should.have.length(1);
|
||||||
list["node-red"].icons[1].should.have.property("path",path.join(__dirname,"resources/local/NestedDirectoryNode/NestedNode/icons"))
|
list["node-red"].icons[0].should.have.property("path",path.join(__dirname,"resources/local/NestedDirectoryNode/NestedNode/icons"))
|
||||||
list["node-red"].icons[1].should.have.property("icons");
|
list["node-red"].icons[0].should.have.property("icons");
|
||||||
list["node-red"].icons[1].icons.should.have.length(1);
|
list["node-red"].icons[0].icons.should.have.length(1);
|
||||||
list["node-red"].icons[1].icons[0].should.eql("arrow-in.png");
|
list["node-red"].icons[0].icons[0].should.eql("arrow-in.png");
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
it("scans icons dir in library",function(done) {
|
it("scans icons dir in library",function(done) {
|
||||||
@ -216,11 +219,11 @@ describe("red/nodes/registry/localfilesystem",function() {
|
|||||||
var list = localfilesystem.getNodeFiles(true);
|
var list = localfilesystem.getNodeFiles(true);
|
||||||
list.should.have.property("node-red");
|
list.should.have.property("node-red");
|
||||||
list["node-red"].should.have.property("icons");
|
list["node-red"].should.have.property("icons");
|
||||||
list["node-red"].icons.should.have.length(2);
|
list["node-red"].icons.should.have.length(1);
|
||||||
list["node-red"].icons[1].should.have.property("path",path.join(__dirname,"resources/userDir/lib/icons"))
|
list["node-red"].icons[0].should.have.property("path",path.join(__dirname,"resources/userDir/lib/icons"))
|
||||||
list["node-red"].icons[1].should.have.property("icons");
|
list["node-red"].icons[0].should.have.property("icons");
|
||||||
list["node-red"].icons[1].icons.should.have.length(1);
|
list["node-red"].icons[0].icons.should.have.length(1);
|
||||||
list["node-red"].icons[1].icons[0].should.eql("test_icon.png");
|
list["node-red"].icons[0].icons[0].should.eql("test_icon.png");
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -19,7 +19,9 @@ var when = require("when");
|
|||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
|
|
||||||
var typeRegistry = require("../../../red/runtime-registry/registry");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var typeRegistry = NR_TEST_UTILS.require("@node-red/registry/lib/registry");
|
||||||
var EventEmitter = require('events');
|
var EventEmitter = require('events');
|
||||||
|
|
||||||
var events = new EventEmitter();
|
var events = new EventEmitter();
|
||||||
@ -518,10 +520,9 @@ describe("red/nodes/registry/registry",function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('#getNodeIconPath', function() {
|
describe('#getNodeIconPath', function() {
|
||||||
it('returns the default icon when getting an unknown icon', function() {
|
it('returns the null when getting an unknown icon', function() {
|
||||||
var defaultIcon = path.resolve(__dirname+'/../../../public/icons/arrow-in.png');
|
|
||||||
var iconPath = typeRegistry.getNodeIconPath('random-module','youwonthaveme.png');
|
var iconPath = typeRegistry.getNodeIconPath('random-module','youwonthaveme.png');
|
||||||
iconPath.should.eql(defaultIcon);
|
should.not.exist(iconPath);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns a registered icon' , function() {
|
it('returns a registered icon' , function() {
|
||||||
@ -543,10 +544,10 @@ describe("red/nodes/registry/registry",function() {
|
|||||||
iconPath.should.eql(path.resolve(testIcon+"/test_icon.png"));
|
iconPath.should.eql(path.resolve(testIcon+"/test_icon.png"));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns the debug icon when getting an unknown module', function() {
|
it('returns null when getting an unknown module', function() {
|
||||||
var debugIcon = path.resolve(__dirname+'/../../../public/icons/debug.png');
|
var debugIcon = path.resolve(__dirname+'/../../../public/icons/debug.png');
|
||||||
var iconPath = typeRegistry.getNodeIconPath('unknown-module', 'debug.png');
|
var iconPath = typeRegistry.getNodeIconPath('unknown-module', 'debug.png');
|
||||||
iconPath.should.eql(debugIcon);
|
should.not.exist(iconPath);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
|
|
||||||
var comms = require("../../../red/runtime-api/comms");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var comms = NR_TEST_UTILS.require("@node-red/runtime/lib/api/comms");
|
||||||
|
|
||||||
describe("runtime-api/comms", function() {
|
describe("runtime-api/comms", function() {
|
||||||
describe("listens for events", function() {
|
describe("listens for events", function() {
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
describe("runtime-api/context", function() {
|
describe("runtime-api/context", function() {
|
||||||
it.skip("NEEDS TESTS WRITING",function() {});
|
it.skip("NEEDS TESTS WRITING",function() {});
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
|
|
||||||
var flows = require("../../../red/runtime-api/flows")
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var flows = NR_TEST_UTILS.require("@node-red/runtime/lib/api/flows")
|
||||||
|
|
||||||
var mockLog = () => ({
|
var mockLog = () => ({
|
||||||
log: sinon.stub(),
|
log: sinon.stub(),
|
||||||
|
@ -17,18 +17,19 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
|
|
||||||
var index = require("../../../red/runtime-api/index");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var index = NR_TEST_UTILS.require("@node-red/runtime/lib/api/index");
|
||||||
|
|
||||||
|
|
||||||
describe("runtime-api/index", function() {
|
describe("runtime-api/index", function() {
|
||||||
before(function() {
|
before(function() {
|
||||||
["comms","flows","nodes","settings","library","projects"].forEach(n => {
|
["comms","flows","nodes","settings","library","projects"].forEach(n => {
|
||||||
sinon.stub(require(`../../../red/runtime-api/${n}`),"init",()=>{});
|
sinon.stub(NR_TEST_UTILS.require(`@node-red/runtime/lib/api/${n}`),"init",()=>{});
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
after(function() {
|
after(function() {
|
||||||
["comms","flows","nodes","settings","library","projects"].forEach(n => {
|
["comms","flows","nodes","settings","library","projects"].forEach(n => {
|
||||||
require(`../../../red/runtime-api/${n}`).init.restore()
|
NR_TEST_UTILS.require(`@node-red/runtime/lib/api/${n}`).init.restore()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
it('isStarted', function(done) {
|
it('isStarted', function(done) {
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
|
|
||||||
var library = require("../../../red/runtime-api/library")
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var library = NR_TEST_UTILS.require("@node-red/runtime/lib/api/library")
|
||||||
|
|
||||||
var mockLog = {
|
var mockLog = {
|
||||||
log: sinon.stub(),
|
log: sinon.stub(),
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
|
|
||||||
var nodes = require("../../../red/runtime-api/nodes")
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var nodes = NR_TEST_UTILS.require("@node-red/runtime/lib/api/nodes")
|
||||||
|
|
||||||
var mockLog = () => ({
|
var mockLog = () => ({
|
||||||
log: sinon.stub(),
|
log: sinon.stub(),
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
|
|
||||||
var projects = require("../../../red/runtime-api/projects")
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var projects = NR_TEST_UTILS.require("@node-red/runtime/lib/api/projects")
|
||||||
|
|
||||||
var mockLog = () => ({
|
var mockLog = () => ({
|
||||||
log: sinon.stub(),
|
log: sinon.stub(),
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
|
|
||||||
var settings = require("../../../red/runtime-api/settings")
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var settings = NR_TEST_UTILS.require("@node-red/runtime/lib/api/settings")
|
||||||
|
|
||||||
var mockLog = () => ({
|
var mockLog = () => ({
|
||||||
log: sinon.stub(),
|
log: sinon.stub(),
|
||||||
|
@ -15,9 +15,11 @@
|
|||||||
**/
|
**/
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
|
|
||||||
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
describe("runtime/events", function() {
|
describe("runtime/events", function() {
|
||||||
it('can be required without errors', function() {
|
it('can be required without errors', function() {
|
||||||
require("../../../red/runtime/events");
|
NR_TEST_UTILS.require("@node-red/runtime/lib/events");
|
||||||
});
|
});
|
||||||
it.skip('more tests needed', function(){})
|
it.skip('more tests needed', function(){})
|
||||||
});
|
});
|
||||||
|
@ -17,13 +17,15 @@ var should = require("should");
|
|||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
|
|
||||||
var api = require("../../../red/api");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var runtime = require("../../../red/runtime");
|
|
||||||
|
|
||||||
var redNodes = require("../../../red/runtime/nodes");
|
var api = NR_TEST_UTILS.require("@node-red/runtime/lib/api");
|
||||||
var storage = require("../../../red/runtime/storage");
|
var runtime = NR_TEST_UTILS.require("@node-red/runtime");
|
||||||
var settings = require("../../../red/runtime/settings");
|
|
||||||
var log = require("../../../red/util/log");
|
var redNodes = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes");
|
||||||
|
var storage = NR_TEST_UTILS.require("@node-red/runtime/lib/storage");
|
||||||
|
var settings = NR_TEST_UTILS.require("@node-red/runtime/lib/settings");
|
||||||
|
var log = NR_TEST_UTILS.require("@node-red/util").log;
|
||||||
|
|
||||||
describe("runtime", function() {
|
describe("runtime", function() {
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
@ -33,7 +35,7 @@ describe("runtime", function() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
before(function() {
|
before(function() {
|
||||||
process.env.NODE_RED_HOME = path.resolve(path.join(__dirname,"..","..",".."))
|
process.env.NODE_RED_HOME = NR_TEST_UTILS.resolve("node-red");
|
||||||
});
|
});
|
||||||
after(function() {
|
after(function() {
|
||||||
delete process.env.NODE_RED_HOME;
|
delete process.env.NODE_RED_HOME;
|
||||||
@ -75,7 +77,10 @@ describe("runtime", function() {
|
|||||||
|
|
||||||
it("returns version", function() {
|
it("returns version", function() {
|
||||||
runtime.init({testSettings: true, httpAdminRoot:"/"},mockUtil());
|
runtime.init({testSettings: true, httpAdminRoot:"/"},mockUtil());
|
||||||
/^\d+\.\d+\.\d+(-git)?$/.test(runtime.version()).should.be.true();
|
return runtime.version().then(version => {
|
||||||
|
/^\d+\.\d+\.\d+(-git)?$/.test(version).should.be.true();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,8 @@ var should = require("should");
|
|||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
|
|
||||||
var library = require("../../../../red/runtime/library/index")
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var library = NR_TEST_UTILS.require("@node-red/runtime/lib/library/index")
|
||||||
|
|
||||||
var mockLog = {
|
var mockLog = {
|
||||||
log: sinon.stub(),
|
log: sinon.stub(),
|
||||||
|
@ -16,9 +16,10 @@
|
|||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
var RedNode = require("../../../../red/runtime/nodes/Node");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var Log = require("../../../../red/util/log");
|
var RedNode = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/Node");
|
||||||
var flows = require("../../../../red/runtime/nodes/flows");
|
var Log = NR_TEST_UTILS.require("@node-red/util").log;
|
||||||
|
var flows = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/flows");
|
||||||
|
|
||||||
describe('Node', function() {
|
describe('Node', function() {
|
||||||
describe('#constructor',function() {
|
describe('#constructor',function() {
|
||||||
|
@ -18,7 +18,8 @@ var should = require("should");
|
|||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var fs = require('fs-extra');
|
var fs = require('fs-extra');
|
||||||
var Context = require("../../../../../red/runtime/nodes/context/index");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var Context = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/context/index");
|
||||||
|
|
||||||
describe('context', function() {
|
describe('context', function() {
|
||||||
describe('local memory',function() {
|
describe('local memory',function() {
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
var should = require('should');
|
var should = require('should');
|
||||||
var fs = require('fs-extra');
|
var fs = require('fs-extra');
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
var LocalFileSystem = require('../../../../../red/runtime/nodes/context/localfilesystem');
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var LocalFileSystem = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/context/localfilesystem");
|
||||||
|
|
||||||
var resourcesDir = path.resolve(path.join(__dirname,"..","resources","context"));
|
var resourcesDir = path.resolve(path.join(__dirname,"..","resources","context"));
|
||||||
|
|
||||||
|
@ -15,7 +15,9 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
var should = require('should');
|
var should = require('should');
|
||||||
var Memory = require('../../../../../red/runtime/nodes/context/memory');
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var Memory = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/context/memory");
|
||||||
|
|
||||||
describe('memory',function() {
|
describe('memory',function() {
|
||||||
var context;
|
var context;
|
||||||
|
@ -19,9 +19,10 @@ var sinon = require("sinon");
|
|||||||
var when = require("when");
|
var when = require("when");
|
||||||
var util = require("util");
|
var util = require("util");
|
||||||
|
|
||||||
var index = require("../../../../red/runtime/nodes/index");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var credentials = require("../../../../red/runtime/nodes/credentials");
|
var index = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/index");
|
||||||
var log = require("../../../../red/util/log");
|
var credentials = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/credentials");
|
||||||
|
var log = NR_TEST_UTILS.require("@node-red/util").log;
|
||||||
|
|
||||||
|
|
||||||
describe('red/runtime/nodes/credentials', function() {
|
describe('red/runtime/nodes/credentials', function() {
|
||||||
|
@ -20,11 +20,13 @@ var sinon = require('sinon');
|
|||||||
var clone = require('clone');
|
var clone = require('clone');
|
||||||
var util = require("util");
|
var util = require("util");
|
||||||
|
|
||||||
var flowUtils = require("../../../../../red/runtime/nodes/flows/util");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var Flow = require("../../../../../red/runtime/nodes/flows/Flow");
|
|
||||||
var flows = require("../../../../../red/runtime/nodes/flows");
|
var flowUtils = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/flows/util");
|
||||||
var Node = require("../../../../../red/runtime/nodes/Node");
|
var Flow = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/flows/Flow");
|
||||||
var typeRegistry = require("../../../../../red/runtime-registry");
|
var flows = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/flows");
|
||||||
|
var Node = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/Node");
|
||||||
|
var typeRegistry = NR_TEST_UTILS.require("@node-red/registry");
|
||||||
|
|
||||||
|
|
||||||
describe('Flow', function() {
|
describe('Flow', function() {
|
||||||
|
@ -18,13 +18,15 @@ var should = require("should");
|
|||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var when = require("when");
|
var when = require("when");
|
||||||
var clone = require("clone");
|
var clone = require("clone");
|
||||||
var flows = require("../../../../../red/runtime/nodes/flows");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var RedNode = require("../../../../../red/runtime/nodes/Node");
|
|
||||||
var RED = require("../../../../../red/runtime/nodes");
|
var flows = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/flows");
|
||||||
var events = require("../../../../../red/runtime/events");
|
var RedNode = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/Node");
|
||||||
var credentials = require("../../../../../red/runtime/nodes/credentials");
|
var RED = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes");
|
||||||
var typeRegistry = require("../../../../../red/runtime-registry");
|
var events = NR_TEST_UTILS.require("@node-red/runtime/lib/events");
|
||||||
var Flow = require("../../../../../red/runtime/nodes/flows/Flow");
|
var credentials = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/credentials");
|
||||||
|
var typeRegistry = NR_TEST_UTILS.require("@node-red/registry")
|
||||||
|
var Flow = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/flows/Flow");
|
||||||
|
|
||||||
describe('flows/index', function() {
|
describe('flows/index', function() {
|
||||||
|
|
||||||
|
@ -18,9 +18,10 @@ var should = require("should");
|
|||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
var when = require("when");
|
var when = require("when");
|
||||||
var clone = require("clone");
|
var clone = require("clone");
|
||||||
var flowUtil = require("../../../../../red/runtime/nodes/flows/util");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var typeRegistry = require("../../../../../red/runtime-registry");
|
var flowUtil = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/flows/util");
|
||||||
var redUtil = require("../../../../../red/runtime/util");
|
var typeRegistry = NR_TEST_UTILS.require("@node-red/registry");
|
||||||
|
var redUtil = NR_TEST_UTILS.require("@node-red/util").util;
|
||||||
|
|
||||||
describe('flows/util', function() {
|
describe('flows/util', function() {
|
||||||
var getType;
|
var getType;
|
||||||
|
@ -21,15 +21,16 @@ var when = require("when");
|
|||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
var inherits = require("util").inherits;
|
var inherits = require("util").inherits;
|
||||||
|
|
||||||
var index = require("../../../../red/runtime/nodes/index");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
var flows = require("../../../../red/runtime/nodes/flows");
|
var index = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/index");
|
||||||
var registry = require("../../../../red/runtime-registry");
|
var flows = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/flows");
|
||||||
var Node = require("../../../../red/runtime/nodes/Node");
|
var registry = NR_TEST_UTILS.require("@node-red/registry")
|
||||||
|
var Node = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/Node");
|
||||||
|
|
||||||
describe("red/nodes/index", function() {
|
describe("red/nodes/index", function() {
|
||||||
before(function() {
|
before(function() {
|
||||||
sinon.stub(index,"startFlows");
|
sinon.stub(index,"startFlows");
|
||||||
process.env.NODE_RED_HOME = path.resolve(path.join(__dirname,"..","..","..",".."))
|
process.env.NODE_RED_HOME = NR_TEST_UTILS.resolve("node-red");
|
||||||
});
|
});
|
||||||
after(function() {
|
after(function() {
|
||||||
index.startFlows.restore();
|
index.startFlows.restore();
|
||||||
@ -168,11 +169,11 @@ describe("red/nodes/index", function() {
|
|||||||
var http = require('http');
|
var http = require('http');
|
||||||
var express = require('express');
|
var express = require('express');
|
||||||
var app = express();
|
var app = express();
|
||||||
var runtime = require("../../../../red/runtime");
|
var runtime = NR_TEST_UTILS.require("@node-red/runtime");
|
||||||
var credentials = require("../../../../red/runtime/nodes/credentials");
|
var credentials = NR_TEST_UTILS.require("@node-red/runtime/lib/nodes/credentials");
|
||||||
var localfilesystem = require("../../../../red/runtime/storage/localfilesystem");
|
var localfilesystem = NR_TEST_UTILS.require("@node-red/runtime/lib/storage/localfilesystem");
|
||||||
var log = require("../../../../red/util/log");
|
var log = NR_TEST_UTILS.require("@node-red/util").log;
|
||||||
var RED = require("../../../../red/red.js");
|
var RED = NR_TEST_UTILS.require("node-red/lib/red.js");
|
||||||
|
|
||||||
var userDir = path.join(__dirname,".testUserHome");
|
var userDir = path.join(__dirname,".testUserHome");
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
|
@ -15,7 +15,8 @@
|
|||||||
**/
|
**/
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
|
|
||||||
var settings = require("../../../red/runtime/settings");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var settings = NR_TEST_UTILS.require("@node-red/runtime/lib/settings");
|
||||||
|
|
||||||
|
|
||||||
describe("red/settings", function() {
|
describe("red/settings", function() {
|
||||||
|
@ -16,7 +16,10 @@
|
|||||||
var when = require("when");
|
var when = require("when");
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var paff = require('path');
|
var paff = require('path');
|
||||||
var storage = require("../../../../red/runtime/storage/index");
|
|
||||||
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var storage = NR_TEST_UTILS.require("@node-red/runtime/lib/storage/index");
|
||||||
|
|
||||||
describe("red/storage/index", function() {
|
describe("red/storage/index", function() {
|
||||||
|
|
||||||
|
@ -18,9 +18,10 @@ var should = require("should");
|
|||||||
var fs = require('fs-extra');
|
var fs = require('fs-extra');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var sinon = require('sinon');
|
var sinon = require('sinon');
|
||||||
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
var localfilesystem = require("../../../../../red/runtime/storage/localfilesystem");
|
var localfilesystem = NR_TEST_UTILS.require("@node-red/runtime/lib/storage/localfilesystem");
|
||||||
var log = require("../../../../../red/util/log");
|
var log = NR_TEST_UTILS.require("@node-red/util").log;
|
||||||
|
|
||||||
describe('storage/localfilesystem', function() {
|
describe('storage/localfilesystem', function() {
|
||||||
var mockRuntime = {
|
var mockRuntime = {
|
||||||
|
@ -17,8 +17,9 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var fs = require('fs-extra');
|
var fs = require('fs-extra');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
var localfilesystemLibrary = require("../../../../../red/runtime/storage/localfilesystem/library");
|
var localfilesystemLibrary = NR_TEST_UTILS.require("@node-red/runtime/lib/storage/localfilesystem/library");
|
||||||
|
|
||||||
describe('storage/localfilesystem/library', function() {
|
describe('storage/localfilesystem/library', function() {
|
||||||
var userDir = path.join(__dirname,".testUserHome");
|
var userDir = path.join(__dirname,".testUserHome");
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
describe("storage/localfilesystem/projects/Project", function() {
|
describe("storage/localfilesystem/projects/Project", function() {
|
||||||
it.skip("NEEDS TESTS WRITING",function() {});
|
it.skip("NEEDS TESTS WRITING",function() {});
|
||||||
})
|
})
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
|
|
||||||
|
|
||||||
var should = require("should");
|
var should = require("should");
|
||||||
var defaultFileSet = require("../../../../../../red/runtime/storage/localfilesystem/projects/defaultFileSet");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var defaultFileSet = NR_TEST_UTILS.require("@node-red/runtime/lib/storage/localfilesystem/projects/defaultFileSet");
|
||||||
|
|
||||||
describe('storage/localfilesystem/projects/defaultFileSet', function() {
|
describe('storage/localfilesystem/projects/defaultFileSet', function() {
|
||||||
var runtime = {
|
var runtime = {
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
var should = require("should");
|
var should = require("should");
|
||||||
var sinon = require("sinon");
|
var sinon = require("sinon");
|
||||||
|
|
||||||
var authCache = require("../../../../../../../red/runtime/storage/localfilesystem/projects/git/authCache")
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
var authCache = NR_TEST_UTILS.require("@node-red/runtime/lib/storage/localfilesystem/projects/git/authCache")
|
||||||
|
|
||||||
describe("localfilesystem/projects/git/authCache", function() {
|
describe("localfilesystem/projects/git/authCache", function() {
|
||||||
|
|
||||||
|
@ -22,7 +22,9 @@ var sinon = require("sinon");
|
|||||||
var child_process = require("child_process");
|
var child_process = require("child_process");
|
||||||
var fs = require("fs-extra");
|
var fs = require("fs-extra");
|
||||||
|
|
||||||
var authServer = require("../../../../../../../red/runtime/storage/localfilesystem/projects/git/authServer");
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var authServer = NR_TEST_UTILS.require("@node-red/runtime/lib/storage/localfilesystem/projects/git/authServer");
|
||||||
|
|
||||||
|
|
||||||
var sendPrompt = function(localPath, prompt) {
|
var sendPrompt = function(localPath, prompt) {
|
||||||
|
@ -22,7 +22,9 @@ var sinon = require("sinon");
|
|||||||
var child_process = require("child_process");
|
var child_process = require("child_process");
|
||||||
var fs = require("fs-extra");
|
var fs = require("fs-extra");
|
||||||
|
|
||||||
var authWriter = "../../../../../../../red/runtime/storage/localfilesystem/projects/git/authWriter";
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
|
var authWriter = NR_TEST_UTILS.resolve("@node-red/runtime/lib/storage/localfilesystem/projects/git/authWriter");
|
||||||
|
|
||||||
function getListenPath() {
|
function getListenPath() {
|
||||||
var seed = (0x100000+Math.random()*0x999999).toString(16);
|
var seed = (0x100000+Math.random()*0x999999).toString(16);
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
var NR_TEST_UTILS = require("nr-test-utils");
|
||||||
|
|
||||||
describe("storage/localfilesystem/projects/git/index", function() {
|
describe("storage/localfilesystem/projects/git/index", function() {
|
||||||
it.skip("NEEDS TESTS WRITING",function() {});
|
it.skip("NEEDS TESTS WRITING",function() {});
|
||||||
})
|
})
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user