smartlog-destination-devtools/test/test.ts

59 lines
1.4 KiB
TypeScript
Raw Normal View History

2018-03-01 22:39:03 +00:00
import { expect, tap } from 'tapbundle';
// preparation
import { ILogContext } from 'smartlog-interfaces';
import * as smartlog from 'smartlog'
const logger = smartlog.getDefaultLogger();
const logContext: ILogContext = {
company: 'Lossless GmbH',
companyunit: 'Lossless.Cloud',
containerName: 'testContainer',
environment: 'staging',
runtime: 'browser',
zone: 'serve.zone'
}
// import the module to test
2018-03-01 22:39:03 +00:00
import * as beautybrowser from '../ts/index';
let testBeautyBrowser: beautybrowser.BeautyBrowser;
tap.test('first test', async () => {
testBeautyBrowser = new beautybrowser.BeautyBrowser()
});
tap.test('should log a normal message', async () => {
testBeautyBrowser.handleLog({
logContext: logContext,
logLevel: 'info',
message: 'wait, what? Hi, this is a message!'
})
})
tap.test('should log a success message', async () => {
testBeautyBrowser.handleLog({
logContext: logContext,
logLevel: 'info',
message: 'success: Hi, this is a message!'
})
})
tap.test('should log a ok message', async () => {
2018-03-01 22:39:03 +00:00
testBeautyBrowser.handleLog({
logContext: logContext,
2018-03-01 22:39:03 +00:00
logLevel: 'info',
message: 'ok: Hi, this is a message!'
})
})
tap.test('should log a error message', async () => {
testBeautyBrowser.handleLog({
logContext: logContext,
logLevel: 'info',
message: 'error: Hi, this is a message!'
})
})
2018-03-01 22:39:03 +00:00
tap.start();