add tests to log
This commit is contained in:
parent
ec58e90437
commit
43bd277959
4 changed files with 51 additions and 6 deletions
39
test/util.log.js
Normal file
39
test/util.log.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
var _ = require('lodash');
|
||||
var chai = chai || require('chai');
|
||||
var sinon = sinon || require('sinon');
|
||||
var should = chai.should();
|
||||
var log = require('../js/util/log');
|
||||
|
||||
describe.only('log utils', function() {
|
||||
afterEach(function() {
|
||||
log.setLevel('info');
|
||||
});
|
||||
|
||||
it('should log debug', function() {
|
||||
sinon.stub(console,'log');
|
||||
log.setLevel('debug');
|
||||
log.debug('hola');
|
||||
|
||||
var arg = console.log.getCall(0).args[0];
|
||||
arg.should.contain('util.log.js');
|
||||
arg.should.contain('hola');
|
||||
console.log.restore();
|
||||
});
|
||||
|
||||
it('should not log debug', function() {
|
||||
sinon.stub(console,'log');
|
||||
log.setLevel('info');
|
||||
log.debug('hola');
|
||||
console.log.called.should.equal(false);
|
||||
console.log.restore();
|
||||
});
|
||||
|
||||
it('should log debug', function() {
|
||||
log.getLevels().debug.should.equal(0);
|
||||
log.getLevels().fatal.should.equal(5);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue