debug/test/debug_spec.js
Hristo Iliev 50ffa9d85e Enable use of custom log function (#379)
* Enable use of custom log function

* Add test for custom log function
2016-12-17 22:56:14 -08:00

32 lines
603 B
JavaScript

import { expect } from 'chai';
import { assert, spy } from 'sinon';
import debug from '../index';
describe('debug', () => {
describe('sanity check', () => {
it('passes', () => {
const log = debug('test');
log('hello world');
});
});
describe('custom functions', () => {
let log;
beforeEach(() => {
debug.enable('test');
log = debug('test');
});
context('with log function', () => {
it('uses it', () => {
log.log = spy();
log('using custom log function');
assert.calledOnce(log.log);
});
});
});
});