summaryrefslogtreecommitdiffstats
path: root/dgbuilder/test/red/nodes/flows_spec.js
diff options
context:
space:
mode:
authorTimoney, Dan (dt5972) <dtimoney@att.com>2018-11-06 13:39:01 -0500
committerTimoney, Dan (dt5972) <dtimoney@att.com>2018-11-06 13:39:01 -0500
commitb9b3b4b74e70cae099a6ccb0dd06427fdb5a2279 (patch)
tree70144dcfb7684b64f2c1fcb35dac538423a101d3 /dgbuilder/test/red/nodes/flows_spec.js
parent78b70b90a20d8e6cd7e9b1da62397aa78b09b7ed (diff)
Remove obsolete dgbuilder
SDNC dgbuilder is no longer used - dgbuilder is now in CCSDK. Change-Id: I496e346ed3864779f36c00c354742f7d36447399 Issue-ID: SDNC-488 Signed-off-by: Timoney, Dan (dt5972) <dtimoney@att.com> Former-commit-id: e38fe292bd511784d1c145e84a9af7d94b6f3669
Diffstat (limited to 'dgbuilder/test/red/nodes/flows_spec.js')
-rw-r--r--dgbuilder/test/red/nodes/flows_spec.js134
1 files changed, 0 insertions, 134 deletions
diff --git a/dgbuilder/test/red/nodes/flows_spec.js b/dgbuilder/test/red/nodes/flows_spec.js
deleted file mode 100644
index 091bf409..00000000
--- a/dgbuilder/test/red/nodes/flows_spec.js
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * Copyright 2014 IBM Corp.
- *
- * 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.
- **/
-
-var should = require("should");
-var sinon = require("sinon");
-var when = require("when");
-var flows = require("../../../red/nodes/flows");
-var RedNode = require("../../../red/nodes/Node");
-var RED = require("../../../red/nodes");
-var events = require("../../../red/events");
-var typeRegistry = require("../../../red/nodes/registry");
-
-
-var settings = {
- available: function() { return false; }
-}
-
-function loadFlows(testFlows, cb) {
- var storage = {
- getFlows: function() {
- return when.resolve(testFlows);
- },
- getCredentials: function() {
- return when.resolve({});
- }
- };
- RED.init(settings, storage);
- flows.load().then(function() {
- should.deepEqual(testFlows, flows.getFlows());
- cb();
- });
-}
-
-describe('flows', function() {
-
- describe('#add',function() {
- it('should be called by node constructor',function(done) {
- var n = new RedNode({id:'123',type:'abc'});
- should.deepEqual(n, flows.get("123"));
- flows.clear().then(function() {
- done();
- });
- });
- });
-
- describe('#each',function() {
- it('should "visit" all nodes',function(done) {
- var nodes = [
- new RedNode({id:'n0'}),
- new RedNode({id:'n1'})
- ];
- var count = 0;
- flows.each(function(node) {
- should.deepEqual(nodes[count], node);
- count += 1;
- if (count == 2) {
- done();
- }
- });
- });
- });
-
- describe('#load',function() {
- it('should load nothing when storage is empty',function(done) {
- loadFlows([], done);
- });
-
- it('should load and start an empty tab flow',function(done) {
- loadFlows([{"type":"tab","id":"tab1","label":"Sheet 1"}], function() {});
- events.once('nodes-started', function() { done(); });
- });
-
- it('should load and start a registered node type', function(done) {
- RED.registerType('debug', function() {});
- var typeRegistryGet = sinon.stub(typeRegistry,"get",function(nt) {
- return function() {};
- });
- loadFlows([{"id":"n1","type":"debug"}], function() { });
- events.once('nodes-started', function() {
- typeRegistryGet.restore();
- done();
- });
- });
-
- it('should load and start when node type is registered', function(done) {
- var typeRegistryGet = sinon.stub(typeRegistry,"get");
- typeRegistryGet.onCall(0).returns(null);
- typeRegistryGet.returns(function(){});
-
- loadFlows([{"id":"n2","type":"inject"}], function() {
- events.emit('type-registered','inject');
- });
- events.once('nodes-started', function() {
- typeRegistryGet.restore();
- done();
- });
- });
- });
-
- describe('#setFlows',function() {
- it('should save and start an empty tab flow',function(done) {
- var saved = 0;
- var testFlows = [{"type":"tab","id":"tab1","label":"Sheet 1"}];
- var storage = {
- saveFlows: function(conf) {
- var defer = when.defer();
- defer.resolve();
- should.deepEqual(testFlows, conf);
- return defer.promise;
- },
- saveCredentials: function (creds) {
- return when(true);
- }
- };
- RED.init(settings, storage);
- flows.setFlows(testFlows);
- events.once('nodes-started', function() { done(); });
- });
- });
-
-});