mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Test Node status method.
This commit is contained in:
parent
d7b3e86096
commit
bbdfa03687
@ -15,7 +15,9 @@
|
||||
**/
|
||||
|
||||
var should = require("should");
|
||||
var sinon = require('sinon');
|
||||
var RedNode = require("../../../red/nodes/Node");
|
||||
var comms = require('../../../red/comms');
|
||||
|
||||
describe('Node', function() {
|
||||
describe('#constructor',function() {
|
||||
@ -274,4 +276,19 @@ describe('Node', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#status', function() {
|
||||
it('publishes status', function(done) {
|
||||
var n = new RedNode({id:'123',type:'abc'});
|
||||
var status = {fill:"green",shape:"dot",text:"connected"};
|
||||
sinon.stub(comms, 'publish', function(topic, message, retain) {
|
||||
topic.should.equal('status/123');
|
||||
message.should.equal(status);
|
||||
retain.should.be.true;
|
||||
done();
|
||||
});
|
||||
|
||||
n.status(status);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user