smartlog-destination-devtools/test/test.browser.ts
2024-05-30 17:58:35 +02:00

58 lines
1.3 KiB
TypeScript

import { expect, tap } from '@push.rocks/tapbundle';
// preparation
import { type ILogContext } from '@push.rocks/smartlog-interfaces';
import * as smartlog from '@push.rocks/smartlog';
const logContext: ILogContext = {
company: 'Lossless GmbH',
companyunit: 'Lossless.Cloud',
containerName: 'testContainer',
environment: 'staging',
runtime: 'chrome',
zone: 'servezone',
};
const logger = new smartlog.Smartlog({
logContext,
});
// import the module to test
import * as smartlogDestinationDevtools from '../ts/index.js';
let testDestination: smartlogDestinationDevtools.SmartlogDestinationDevtools;
tap.test('first test', async () => {
testDestination = new smartlogDestinationDevtools.SmartlogDestinationDevtools();
});
tap.test('should log a normal message', async () => {
testDestination.handleLog({
timestamp: Date.now(),
type: 'log',
context: logContext,
level: 'info',
message: 'wait, what? Hi, this is a message!',
correlation: {
id: '123',
type: 'none',
},
});
});
tap.test('should log a success message', async () => {
testDestination.handleLog({
timestamp: Date.now(),
context: logContext,
type: 'log',
level: 'info',
message: 'success: Hi, this is a message!',
correlation: {
id: '123',
type: 'none',
},
});
});
tap.start();