File size: 886 Bytes
5fae594 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
'use strict';
var expect = require('expect.js');
var Log = require('../index');
describe('log_', function () {
var __log, log, message;
before(function () {
__log = console.log;
console.log = function () {
__log.apply(console, arguments);
message = arguments;
};
});
after(function () {
console.log = __log;
});
it('should log', function () {
log = Log('test', 'blue');
log('hello', 'world');
expect(message).to.have.length(3);
expect(message[0]).to.equal('\u001b[34m[test]\u001b[0m');
expect(message[1]).to.equal('hello');
expect(message[2]).to.equal('world');
});
it('should warn', function () {
log = Log('test', 'blue');
log.warn('help!');
expect(message).to.have.length(2);
expect(message[0]).to.equal('\u001b[31m[test]\u001b[0m');
expect(message[1]).to.equal('help!');
});
});
|