mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix registry test for Node 5
This commit is contained in:
parent
626cba4002
commit
db686388b9
@ -428,6 +428,8 @@ describe("red/nodes/registry/registry",function() {
|
||||
});
|
||||
|
||||
describe('#registerNodeConstructor', function() {
|
||||
function TestNodeConstructor() {
|
||||
}
|
||||
beforeEach(function() {
|
||||
sinon.stub(events,'emit');
|
||||
});
|
||||
@ -435,19 +437,19 @@ describe("red/nodes/registry/registry",function() {
|
||||
events.emit.restore();
|
||||
});
|
||||
it('registers a node constructor', function() {
|
||||
typeRegistry.registerNodeConstructor('node-type',{});
|
||||
typeRegistry.registerNodeConstructor('node-type',TestNodeConstructor);
|
||||
events.emit.calledOnce.should.be.true;
|
||||
events.emit.lastCall.args[0].should.eql('type-registered');
|
||||
events.emit.lastCall.args[1].should.eql('node-type');
|
||||
})
|
||||
it('throws error on duplicate node registration', function() {
|
||||
typeRegistry.registerNodeConstructor('node-type',{});
|
||||
typeRegistry.registerNodeConstructor('node-type',TestNodeConstructor);
|
||||
events.emit.calledOnce.should.be.true;
|
||||
events.emit.lastCall.args[0].should.eql('type-registered');
|
||||
events.emit.lastCall.args[1].should.eql('node-type');
|
||||
/*jshint immed: false */
|
||||
(function(){
|
||||
typeRegistry.registerNodeConstructor('node-type',{});
|
||||
typeRegistry.registerNodeConstructor('node-type',TestNodeConstructor);
|
||||
}).should.throw("node-type already registered");
|
||||
events.emit.calledOnce.should.be.true;
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user