smartlog/test/test.ts

25 lines
698 B
TypeScript
Raw Normal View History

2018-10-30 17:56:26 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
2018-06-05 18:48:14 +00:00
import * as smartlog from '../ts/index';
2018-01-28 03:31:06 +00:00
let defaultLogger: smartlog.Smartlog;
2018-06-05 18:48:14 +00:00
tap.test('should produce instance of Smartlog', async () => {
defaultLogger = smartlog.defaultLogger;
2018-01-28 03:31:06 +00:00
expect(defaultLogger).to.be.instanceOf(smartlog.Smartlog);
});
2018-06-05 18:48:14 +00:00
tap.test('should enable console logging', async () => {
2020-06-05 01:53:09 +00:00
defaultLogger.enableConsole({
captureAll: true
});
console.log('this is a normal log that should be captured');
console.log(new Error('hi there'));
defaultLogger.log('info', 'this should only be printed once');
2018-01-28 03:31:06 +00:00
});
2018-06-05 18:48:14 +00:00
tap.test('should be able to log things', async () => {
defaultLogger.log('silly', 'hi');
2018-01-28 03:31:06 +00:00
});
tap.start();