mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Big rework of registry.js
Part of #322 Loads node.html files before node.js files Adds helper.unload which must be called by node tests to clear the registery of nodes
This commit is contained in:
@@ -23,6 +23,10 @@ describe('inject node', function() {
|
||||
before(function(done) {
|
||||
helper.startServer(done);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
helper.unload();
|
||||
});
|
||||
|
||||
it('should inject once', function(done) {
|
||||
|
||||
|
@@ -24,6 +24,11 @@ describe('debug node', function() {
|
||||
before(function(done) {
|
||||
helper.startServer(done);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
helper.unload();
|
||||
});
|
||||
|
||||
|
||||
it('should be loaded', function(done) {
|
||||
var flow = [{id:"n1", type:"debug", name: "Debug" }];
|
||||
|
@@ -23,6 +23,10 @@ describe('function node', function() {
|
||||
before(function(done) {
|
||||
helper.startServer(done);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
helper.unload();
|
||||
});
|
||||
|
||||
it('should be loaded', function(done) {
|
||||
var flow = [{id:"n1", type:"function", name: "function" }];
|
||||
|
@@ -23,6 +23,11 @@ describe('template node', function() {
|
||||
before(function(done) {
|
||||
helper.startServer(done);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
helper.unload();
|
||||
});
|
||||
|
||||
|
||||
it('should modify payload', function(done) {
|
||||
var flow = [{id:"n1", type:"template", field: "payload", template: "payload={{payload}}",wires:[["n2"]]},{id:"n2",type:"helper"}];
|
||||
|
@@ -20,6 +20,10 @@ var helper = require("../../helper.js");
|
||||
|
||||
describe('comment node', function() {
|
||||
|
||||
afterEach(function() {
|
||||
helper.unload();
|
||||
});
|
||||
|
||||
it('should be loaded', function(done) {
|
||||
var flow = [{id:"n1", type:"comment", name: "comment" }];
|
||||
helper.load(commentNode, flow, function() {
|
||||
|
@@ -23,6 +23,10 @@ describe('JSON node', function() {
|
||||
before(function(done) {
|
||||
helper.startServer(done);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
helper.unload();
|
||||
});
|
||||
|
||||
it('should be loaded', function(done) {
|
||||
var flow = [{id:"jsonNode1", type:"json", name: "jsonNode" }];
|
||||
|
@@ -42,7 +42,7 @@ describe('TailNode', function() {
|
||||
});
|
||||
|
||||
afterEach(function(done) {
|
||||
|
||||
helper.unload();
|
||||
fs.exists(fileToTail, function(exists) {
|
||||
if(exists) {
|
||||
fs.unlinkSync(fileToTail);
|
||||
|
@@ -59,6 +59,10 @@ module.exports = {
|
||||
cb();
|
||||
});
|
||||
},
|
||||
unload: function() {
|
||||
// TODO: any other state to remove between tests?
|
||||
redNodes.clearRegistry();
|
||||
},
|
||||
|
||||
getNode: function(id) {
|
||||
return flows.get(id);
|
||||
|
Reference in New Issue
Block a user