1
0
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:
Mark Hindess 2014-07-30 10:39:48 +01:00
parent d7b3e86096
commit bbdfa03687

View File

@ -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);
});
});
});