Renable unit tests following logging api changes

This commit is contained in:
Nick O'Leary
2015-01-29 09:57:09 +00:00
parent 109270b437
commit f983e4da9f
6 changed files with 180 additions and 145 deletions

View File

@@ -122,29 +122,34 @@ describe('html node', function() {
});
});
});
// HELEN - commenting out for now
// it('should log on error', function(done) {
// fs.readFile(file,function(err, data) {
// var flow = [{id:"n1",type:"html",wires:[["n2"]],tag:"p"},
// {id:"n2", type:"helper"}];
//
// helper.load(htmlNode, flow, function() {
// var n1 = helper.getNode("n1");
// var n2 = helper.getNode("n2");
// n1.on("log", function(msg) {
// if (msg.level && (msg.level === 'metric')) {
// // do nothing as we've just hit a metric related msg
// } else {
// msg.should.have.property('msg');
// msg.msg.indexOf("Error:").should.be.above(-1);
// msg.msg.should.startWith("Error:");
// done();
// }
// });
// n1.receive({payload:null,topic: "bar"});
// });
// });
// });
it('should log on error', function(done) {
fs.readFile(file,function(err, data) {
var flow = [{id:"n1",type:"html",wires:[["n2"]],tag:"p"},
{id:"n2", type:"helper"}];
helper.load(htmlNode, flow, function() {
var n1 = helper.getNode("n1");
var n2 = helper.getNode("n2");
try {
helper.log().called.should.be.false;
n1.receive({payload:null,topic: "bar"});
helper.log().called.should.be.true;
var logEvents = helper.log().args.filter(function(evt) {
return evt[0].level == "log";
});
logEvents.should.have.length(1);
// Each logEvent is the array of args passed to the function.
logEvents[0][0].should.have.a.property('msg');
logEvents[0][0].msg.should.startWith("Error:");
done();
} catch(err) {
done(err);
}
});
});
});
describe('multiple messages', function(){
var cnt = 0;