mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
boost api index, nodes index and nodes Node test coverage
This commit is contained in:
@@ -417,14 +417,13 @@ describe('Node', function() {
|
||||
});
|
||||
|
||||
var message = {a:1};
|
||||
|
||||
n.error("an error message",message);
|
||||
should.deepEqual({level:Log.ERROR, id:n.id,
|
||||
type:n.type, msg:"an error message"}, loginfo);
|
||||
|
||||
|
||||
n.error(null,message);
|
||||
should.deepEqual({level:Log.ERROR, id:n.id, type:n.type, msg:""}, loginfo);
|
||||
|
||||
flows.handleError.called.should.be.true;
|
||||
flows.handleError.args[0][0].should.eql(n);
|
||||
flows.handleError.args[0][1].should.eql("an error message");
|
||||
flows.handleError.args[0][1].should.eql("");
|
||||
flows.handleError.args[0][2].should.eql(message);
|
||||
|
||||
Log.log.restore();
|
||||
@@ -448,8 +447,22 @@ describe('Node', function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
describe('#metric', function() {
|
||||
it('returns metric value if eventname undefined', function(done) {
|
||||
var n = new RedNode({id:'123',type:'abc'});
|
||||
var loginfo = {};
|
||||
sinon.stub(Log, 'log', function(msg) {
|
||||
loginfo = msg;
|
||||
});
|
||||
var msg = {payload:"foo", _msgid:"987654321"};
|
||||
var m = n.metric(undefined,msg,"15mb");
|
||||
m.should.equal(true);
|
||||
Log.log.restore();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
describe('#status', function() {
|
||||
after(function() {
|
||||
comms.publish.restore();
|
||||
|
@@ -58,7 +58,6 @@ describe("red/nodes/index", function() {
|
||||
}
|
||||
|
||||
it('nodes are initialised with credentials',function(done) {
|
||||
|
||||
index.init(settings, storage);
|
||||
index.registerType('test', TestNode);
|
||||
index.loadFlows().then(function() {
|
||||
@@ -69,7 +68,6 @@ describe("red/nodes/index", function() {
|
||||
}).otherwise(function(err) {
|
||||
done(err);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it('flows should be initialised',function(done) {
|
||||
@@ -128,7 +126,7 @@ describe("red/nodes/index", function() {
|
||||
foo: {type:"test"}
|
||||
}
|
||||
});
|
||||
var testnode = new TestNode({id:'tab1',type:'test',name:'barney'});
|
||||
var testnode = new TestNode({id:'tab1',type:'test',name:'barney', '_alias':'tab1'});
|
||||
credentials.getDefinition("test").should.have.property('foo');
|
||||
done();
|
||||
});
|
||||
|
Reference in New Issue
Block a user