2022-03-07 21:45:04 +00:00
|
|
|
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
|
2018-11-11 18:40:59 +00:00
|
|
|
import { Qenv } from '@pushrocks/qenv';
|
|
|
|
import * as smartlog from '@pushrocks/smartlog';
|
|
|
|
const testQenv = new Qenv('./', './.nogit/');
|
|
|
|
|
2022-06-26 07:27:01 +00:00
|
|
|
import * as smartlogDestinationReceiver from '../ts/index.js';
|
2018-11-11 13:29:26 +00:00
|
|
|
|
2018-11-11 18:40:59 +00:00
|
|
|
let testSmartlogReceiver: smartlogDestinationReceiver.SmartlogDestinationReceiver;
|
|
|
|
|
|
|
|
tap.test('should create a valid SmartlogDestinationReceiver', async () => {
|
|
|
|
testSmartlogReceiver = new smartlogDestinationReceiver.SmartlogDestinationReceiver({
|
2020-06-07 12:33:36 +00:00
|
|
|
receiverEndpoint: testQenv.getEnvVarOnDemand('RECEIVER_ENDPOINT'),
|
2022-06-26 07:27:01 +00:00
|
|
|
passphrase: testQenv.getEnvVarOnDemand('PASSPHRASE'),
|
2018-11-11 18:40:59 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
tap.test('should send a valid message', async () => {
|
|
|
|
testSmartlogReceiver.handleLog({
|
|
|
|
timestamp: Date.now(),
|
|
|
|
context: {
|
|
|
|
company: 'Lossless GmbH',
|
|
|
|
companyunit: 'Lossless Cloud',
|
2020-06-05 16:25:36 +00:00
|
|
|
containerName: 'tapbundle-test',
|
2018-11-11 18:40:59 +00:00
|
|
|
environment: 'local',
|
|
|
|
runtime: 'node',
|
2022-06-26 07:27:01 +00:00
|
|
|
zone: 'gitzone',
|
2018-11-11 18:40:59 +00:00
|
|
|
},
|
|
|
|
type: 'log',
|
|
|
|
level: 'info',
|
2020-06-05 16:25:36 +00:00
|
|
|
correlation: {
|
|
|
|
id: '123',
|
2022-06-26 07:27:01 +00:00
|
|
|
type: 'none',
|
2020-06-05 16:25:36 +00:00
|
|
|
},
|
2022-06-26 07:27:01 +00:00
|
|
|
message: 'This is a message',
|
2018-11-11 18:40:59 +00:00
|
|
|
});
|
2018-11-11 13:29:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
tap.start();
|