mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fixup all the tests
This commit is contained in:
@@ -60,7 +60,7 @@ describe('red/nodes/registry/index', function() {
|
||||
registry.addModule("foo").then(function(info) {
|
||||
info.should.eql("info");
|
||||
done();
|
||||
}).otherwise(function(err) { done(err); });
|
||||
}).catch(function(err) { done(err); });
|
||||
});
|
||||
it('rejects if loader rejects', function(done) {
|
||||
stubs.push(sinon.stub(loader,"addModule",function(module) {
|
||||
@@ -71,7 +71,7 @@ describe('red/nodes/registry/index', function() {
|
||||
}));
|
||||
registry.addModule("foo").then(function(info) {
|
||||
done(new Error("unexpected resolve"));
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
err.should.eql("error");
|
||||
done();
|
||||
})
|
||||
@@ -90,7 +90,7 @@ describe('red/nodes/registry/index', function() {
|
||||
typeRegistry.enableNodeSet.called.should.be.true();
|
||||
ns.should.have.a.property('id','node-set');
|
||||
done();
|
||||
}).otherwise(function(err) { done(err); });
|
||||
}).catch(function(err) { done(err); });
|
||||
});
|
||||
|
||||
it('rejects if node unknown',function() {
|
||||
@@ -121,7 +121,7 @@ describe('red/nodes/registry/index', function() {
|
||||
ns.should.have.a.property('id','node-set');
|
||||
ns.should.have.a.property('loaded',true);
|
||||
done();
|
||||
}).otherwise(function(err) { done(err); });
|
||||
}).catch(function(err) { done(err); });
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -83,7 +83,7 @@ describe('nodes/registry/installer', function() {
|
||||
return ee;
|
||||
});
|
||||
|
||||
installer.installModule("this_wont_exist").otherwise(function(err) {
|
||||
installer.installModule("this_wont_exist").catch(function(err) {
|
||||
err.should.have.property("code",404);
|
||||
done();
|
||||
});
|
||||
@@ -105,7 +105,7 @@ describe('nodes/registry/installer', function() {
|
||||
}
|
||||
});
|
||||
|
||||
installer.installModule("this_wont_exist","0.1.2").otherwise(function(err) {
|
||||
installer.installModule("this_wont_exist","0.1.2").catch(function(err) {
|
||||
err.code.should.be.eql(404);
|
||||
done();
|
||||
});
|
||||
@@ -116,7 +116,7 @@ describe('nodes/registry/installer', function() {
|
||||
version: "0.1.1"
|
||||
}
|
||||
});
|
||||
installer.installModule("this_wont_exist","0.1.1").otherwise(function(err) {
|
||||
installer.installModule("this_wont_exist","0.1.1").catch(function(err) {
|
||||
err.code.should.be.eql('module_already_loaded');
|
||||
done();
|
||||
});
|
||||
@@ -135,7 +135,7 @@ describe('nodes/registry/installer', function() {
|
||||
|
||||
installer.installModule("this_wont_exist").then(function() {
|
||||
done(new Error("Unexpected success"));
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -160,7 +160,7 @@ describe('nodes/registry/installer', function() {
|
||||
// commsMessages[0].topic.should.equal("node/added");
|
||||
// commsMessages[0].msg.should.eql(nodeInfo.nodes);
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
@@ -169,7 +169,7 @@ describe('nodes/registry/installer', function() {
|
||||
var resourcesDir = path.resolve(path.join(__dirname,"..","resources","local","TestNodeModule","node_modules","NonExistant"));
|
||||
installer.installModule(resourcesDir).then(function() {
|
||||
done(new Error("Unexpected success"));
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
if (err.hasOwnProperty("code")) {
|
||||
err.code.should.eql(404);
|
||||
done();
|
||||
@@ -199,7 +199,7 @@ describe('nodes/registry/installer', function() {
|
||||
installer.installModule(resourcesDir).then(function(info) {
|
||||
info.should.eql(nodeInfo);
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
@@ -228,7 +228,7 @@ describe('nodes/registry/installer', function() {
|
||||
|
||||
installer.uninstallModule("this_wont_exist").then(function() {
|
||||
done(new Error("Unexpected success"));
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -252,7 +252,7 @@ describe('nodes/registry/installer', function() {
|
||||
// commsMessages[0].topic.should.equal("node/removed");
|
||||
// commsMessages[0].msg.should.eql(nodeInfo);
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
@@ -69,7 +69,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
loader.load("foo",true).then(function() {
|
||||
registry.saveNodeList.called.should.be.true();
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
})
|
||||
});
|
||||
@@ -118,7 +118,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
nodes.registerType.lastCall.args[1].should.eql('test-node-1');
|
||||
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
@@ -169,7 +169,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
nodes.registerType.secondCall.args[1].should.eql('test-node-multiple-1b');
|
||||
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
@@ -219,7 +219,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
nodes.registerType.lastCall.args[1].should.eql('test-node-2');
|
||||
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
@@ -267,7 +267,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
nodes.registerType.calledOnce.should.be.false();
|
||||
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
@@ -313,7 +313,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
nodes.registerType.calledOnce.should.be.false();
|
||||
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
@@ -360,7 +360,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
nodes.registerType.calledOnce.should.be.false();
|
||||
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
@@ -379,7 +379,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
stubs.push(sinon.stub(registry,"getModuleInfo",function(){return{}}));
|
||||
loader.init({nodes:nodes,i18n:{defaultLang:"en-US"},events:{on:function(){},removeListener:function(){}},log:{info:function(){},_:function(){}},settings:{available:function(){return true;}}});
|
||||
|
||||
loader.addModule("test-module").otherwise(function(err) {
|
||||
loader.addModule("test-module").catch(function(err) {
|
||||
err.code.should.eql("module_already_loaded");
|
||||
done();
|
||||
});
|
||||
@@ -390,7 +390,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
throw new Error("failure");
|
||||
}));
|
||||
loader.init({nodes:nodes,i18n:{defaultLang:"en-US"},events:{on:function(){},removeListener:function(){}},log:{info:function(){},_:function(){}},settings:{available:function(){return true;}}});
|
||||
loader.addModule("test-module").otherwise(function(err) {
|
||||
loader.addModule("test-module").catch(function(err) {
|
||||
err.message.should.eql("failure");
|
||||
done();
|
||||
});
|
||||
@@ -441,7 +441,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
|
||||
nodes.registerType.calledOnce.should.be.true();
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
@@ -477,7 +477,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
registry.addNodeSet.called.should.be.false();
|
||||
nodes.registerType.called.should.be.false();
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
@@ -498,7 +498,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
node.enabled.should.be.false();
|
||||
nodes.registerType.called.should.be.false();
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
@@ -517,7 +517,7 @@ describe("red/nodes/registry/loader",function() {
|
||||
node.err.toString().should.eql("Error: fail to require (line:1)");
|
||||
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
@@ -292,7 +292,7 @@ describe("red/nodes/registry/registry",function() {
|
||||
it('rejects when settings unavailable',function(done) {
|
||||
typeRegistry.init(stubSettings({},false,{}));
|
||||
typeRegistry.addNodeSet("test-module/test-name",testNodeSet1, "0.0.1");
|
||||
typeRegistry.saveNodeList().otherwise(function(err) {
|
||||
typeRegistry.saveNodeList().catch(function(err) {
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -312,7 +312,7 @@ describe("red/nodes/registry/registry",function() {
|
||||
nn.should.not.have.property('id');
|
||||
}
|
||||
done();
|
||||
}).otherwise(function(err) {
|
||||
}).catch(function(err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user