mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add tests for async close
This commit is contained in:
parent
8f1dd62515
commit
820ca4475d
@ -48,11 +48,29 @@ describe('Node', function() {
|
||||
describe('#close', function() {
|
||||
it('emits close event when closed',function(done) {
|
||||
var n = new RedNode({id:'123',type:'abc'});
|
||||
n.on('close',done);
|
||||
n.close();
|
||||
n.on('close',function() {
|
||||
done();
|
||||
});
|
||||
var p = n.close();
|
||||
should.not.exist(p);
|
||||
});
|
||||
|
||||
it('returns a promise when provided a callback with a done parameter',function(testdone) {
|
||||
var n = new RedNode({id:'123',type:'abc'});
|
||||
n.on('close',function(done) {
|
||||
setTimeout(function() {
|
||||
done();
|
||||
},200);
|
||||
});
|
||||
var p = n.close();
|
||||
should.exist(p);
|
||||
p.then(function() {
|
||||
testdone();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('#receive', function() {
|
||||
it('emits input event when called', function(done) {
|
||||
var n = new RedNode({id:'123',type:'abc'});
|
||||
|
Loading…
Reference in New Issue
Block a user