1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add more Node tests.

This commit is contained in:
Mark Hindess 2014-07-09 07:42:09 +01:00
parent de352dcdc2
commit 0a7bd848c6

View File

@ -170,6 +170,55 @@ describe('Node', function() {
n1.send(messages); n1.send(messages);
}); });
});
describe('#log', function() {
it('emits a log message', function(done) {
var n = new RedNode({id:'123',type:'abc'});
n.on('log',function(obj) {
should.deepEqual({level:"log", id:n.id,
type:n.type, msg:"a log message"}, obj);
done();
});
n.log("a log message");
});
});
describe('#log', function() {
it('emits a log message with a name', function(done) {
var n = new RedNode({id:'123', type:'abc', name:"barney"});
n.on('log',function(obj) {
should.deepEqual({level:"log", id:n.id, name: "barney",
type:n.type, msg:"a log message"}, obj);
done();
});
n.log("a log message");
});
});
describe('#warn', function() {
it('emits a warning', function(done) {
var n = new RedNode({id:'123',type:'abc'});
n.on('log',function(obj) {
should.deepEqual({level:"warn", id:n.id,
type:n.type, msg:"a warning"}, obj);
done();
});
n.warn("a warning");
});
});
describe('#error', function() {
it('emits an error message', function(done) {
var n = new RedNode({id:'123',type:'abc'});
n.on('log',function(obj) {
should.deepEqual({level:"error", id:n.id,
type:n.type, msg:"an error message"}, obj);
done();
});
n.error("an error message");
});
}); });
}); });