smartlog-destination-devtools/test/test.ts

47 lines
1.2 KiB
TypeScript
Raw Normal View History

2018-11-13 00:32:39 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
// preparation
2018-11-13 00:32:39 +00:00
import { ILogContext } from '@pushrocks/smartlog-interfaces';
import * as smartlog from '@pushrocks/smartlog';
2018-11-13 00:32:39 +00:00
const logger = smartlog.defaultLogger;
const logContext: ILogContext = {
company: 'Lossless GmbH',
companyunit: 'Lossless.Cloud',
containerName: 'testContainer',
environment: 'staging',
2018-11-13 00:32:39 +00:00
runtime: 'chrome',
zone: 'servezone'
};
// import the module to test
2018-11-13 00:32:39 +00:00
import * as smartlogDestinationDevtools from '../ts/index';
2018-03-01 22:39:03 +00:00
2018-11-13 00:32:39 +00:00
let testDestination: smartlogDestinationDevtools.SmartlogDestinationDevtools;
2018-03-01 22:39:03 +00:00
tap.test('first test', async () => {
2018-11-13 00:32:39 +00:00
testDestination = new smartlogDestinationDevtools.SmartlogDestinationDevtools();
2018-03-01 22:39:03 +00:00
});
tap.test('should log a normal message', async () => {
2018-11-13 00:32:39 +00:00
testDestination.handleLog({
timestamp: Date.now(),
type: 'log',
context: logContext,
level: 'info',
message: 'wait, what? Hi, this is a message!'
2018-11-13 00:32:39 +00:00
});
});
tap.test('should log a success message', async () => {
2018-11-13 00:32:39 +00:00
testDestination.handleLog({
timestamp: Date.now(),
context: logContext,
type: 'log',
level: 'info',
message: 'success: Hi, this is a message!'
2018-11-13 00:32:39 +00:00
});
});
2018-03-01 22:39:03 +00:00
tap.start();