2020-03-30 23:23:53 +00:00
|
|
|
import { expect } from 'chai';
|
|
|
|
import { ConsoleLogger, NullLogger } from 'noicejs';
|
|
|
|
|
2022-10-08 19:10:17 +00:00
|
|
|
import { getTestLogger, spyLogger } from '../src/Logger.js';
|
2020-03-30 23:23:53 +00:00
|
|
|
|
|
|
|
describe('logger utils', () => {
|
|
|
|
describe('get test logger helper', () => {
|
2022-10-08 19:10:17 +00:00
|
|
|
it('should return console logger in verbose mode', async () => {
|
2020-03-30 23:23:53 +00:00
|
|
|
expect(getTestLogger(true)).to.equal(ConsoleLogger.global);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return console logger in debug mode');
|
|
|
|
|
2022-10-08 19:10:17 +00:00
|
|
|
it('should return null logger otherwise', async () => {
|
2020-03-30 23:23:53 +00:00
|
|
|
expect(getTestLogger()).to.equal(NullLogger.global);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('spy logger helper', () => {
|
2022-10-08 19:10:17 +00:00
|
|
|
it('should return itself as a child', async () => {
|
2020-03-30 23:23:53 +00:00
|
|
|
const logger = spyLogger({});
|
|
|
|
expect(logger.child({})).to.equal(logger);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|