Handle additional debug msg props in Node_spec

This commit is contained in:
Nick O'Leary 2018-04-17 23:29:56 +01:00
parent ff18618032
commit eccd5e9801
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 10 additions and 10 deletions

View File

@ -391,26 +391,26 @@ describe('Node', function() {
describe('#log', function() { describe('#log', function() {
it('produces a log message', function(done) { it('produces a log message', function(done) {
var n = new RedNode({id:'123',type:'abc'}); var n = new RedNode({id:'123',type:'abc',z:'789'});
var loginfo = {}; var loginfo = {};
sinon.stub(Log, 'log', function(msg) { sinon.stub(Log, 'log', function(msg) {
loginfo = msg; loginfo = msg;
}); });
n.log("a log message"); n.log("a log message");
should.deepEqual({level:Log.INFO, id:n.id, should.deepEqual({level:Log.INFO, id:n.id,
type:n.type, msg:"a log message", }, loginfo); type:n.type, msg:"a log message",_alias:undefined, z:'789'}, loginfo);
Log.log.restore(); Log.log.restore();
done(); done();
}); });
it('produces a log message with a name', function(done) { it('produces a log message with a name', function(done) {
var n = new RedNode({id:'123', type:'abc', name:"barney"}); var n = new RedNode({id:'123', type:'abc', name:"barney", z:'789'});
var loginfo = {}; var loginfo = {};
sinon.stub(Log, 'log', function(msg) { sinon.stub(Log, 'log', function(msg) {
loginfo = msg; loginfo = msg;
}); });
n.log("a log message"); n.log("a log message");
should.deepEqual({level:Log.INFO, id:n.id, name: "barney", should.deepEqual({level:Log.INFO, id:n.id, name: "barney",
type:n.type, msg:"a log message"}, loginfo); type:n.type, msg:"a log message",_alias:undefined, z:'789'}, loginfo);
Log.log.restore(); Log.log.restore();
done(); done();
}); });
@ -418,14 +418,14 @@ describe('Node', function() {
describe('#warn', function() { describe('#warn', function() {
it('produces a warning message', function(done) { it('produces a warning message', function(done) {
var n = new RedNode({id:'123',type:'abc'}); var n = new RedNode({id:'123',type:'abc',z:'789'});
var loginfo = {}; var loginfo = {};
sinon.stub(Log, 'log', function(msg) { sinon.stub(Log, 'log', function(msg) {
loginfo = msg; loginfo = msg;
}); });
n.warn("a warning"); n.warn("a warning");
should.deepEqual({level:Log.WARN, id:n.id, should.deepEqual({level:Log.WARN, id:n.id,
type:n.type, msg:"a warning"}, loginfo); type:n.type, msg:"a warning",_alias:undefined, z:'789'}, loginfo);
Log.log.restore(); Log.log.restore();
done(); done();
}); });
@ -433,7 +433,7 @@ describe('Node', function() {
describe('#error', function() { describe('#error', function() {
it('handles a null error message', function(done) { it('handles a null error message', function(done) {
var n = new RedNode({id:'123',type:'abc'}); var n = new RedNode({id:'123',type:'abc',z:'789'});
var loginfo = {}; var loginfo = {};
sinon.stub(Log, 'log', function(msg) { sinon.stub(Log, 'log', function(msg) {
loginfo = msg; loginfo = msg;
@ -444,7 +444,7 @@ describe('Node', function() {
var message = {a:1}; var message = {a:1};
n.error(null,message); n.error(null,message);
should.deepEqual({level:Log.ERROR, id:n.id, type:n.type, msg:""}, loginfo); should.deepEqual({level:Log.ERROR, id:n.id, type:n.type, msg:"",_alias:undefined, z:'789'}, loginfo);
flows.handleError.called.should.be.true(); flows.handleError.called.should.be.true();
flows.handleError.args[0][0].should.eql(n); flows.handleError.args[0][0].should.eql(n);
@ -457,7 +457,7 @@ describe('Node', function() {
}); });
it('produces an error message', function(done) { it('produces an error message', function(done) {
var n = new RedNode({id:'123',type:'abc'}); var n = new RedNode({id:'123',type:'abc',z:'789'});
var loginfo = {}; var loginfo = {};
sinon.stub(Log, 'log', function(msg) { sinon.stub(Log, 'log', function(msg) {
loginfo = msg; loginfo = msg;
@ -468,7 +468,7 @@ describe('Node', function() {
var message = {a:2}; var message = {a:2};
n.error("This is an error",message); n.error("This is an error",message);
should.deepEqual({level:Log.ERROR, id:n.id, type:n.type, msg:"This is an error"}, loginfo); should.deepEqual({level:Log.ERROR, id:n.id, type:n.type, msg:"This is an error",_alias:undefined, z:'789'}, loginfo);
flows.handleError.called.should.be.true(); flows.handleError.called.should.be.true();
flows.handleError.args[0][0].should.eql(n); flows.handleError.args[0][0].should.eql(n);