logdna/test/test.ts

36 lines
966 B
TypeScript
Raw Normal View History

2018-11-01 17:13:34 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
2018-11-02 08:07:47 +00:00
import * as logdna from '../ts/index';
2018-11-01 17:13:34 +00:00
2018-11-02 08:07:47 +00:00
import { Qenv } from '@pushrocks/qenv';
2018-11-01 17:13:34 +00:00
2018-11-02 08:07:47 +00:00
const testQenv = new Qenv('./', './.nogit');
let testLogDnaAccount: logdna.LogdnaAccount;
let testLogMessage: logdna.LogdnaMessage;
tap.test('should create a valid logDna account', async () => {
2018-11-02 12:57:14 +00:00
testLogDnaAccount = new logdna.LogdnaAccount(process.env.LOGDNA_APIKEY);
2018-11-02 08:07:47 +00:00
});
tap.test('should create a standard log message', async () => {
2018-11-02 12:57:14 +00:00
testLogMessage = logdna.LogdnaMessage.fromSmartLogPackage({
2018-11-03 22:31:26 +00:00
type: 'log',
level: 'info',
context: {
2018-11-02 12:57:14 +00:00
company: 'Lossless GmbH',
companyunit: 'lossless.cloud',
containerName: 'ci-mojoio-logdna',
environment: 'test',
runtime: 'node',
zone: 'ship.zone'
},
message: 'this is a awesome log message :)'
});
2018-11-02 08:07:47 +00:00
});
2018-11-02 18:12:16 +00:00
tap.test('should send the message', async () => {
await testLogDnaAccount.sendLogDnaMessage(testLogMessage);
2018-11-03 15:22:32 +00:00
});
2018-11-02 18:12:16 +00:00
2018-11-02 08:07:47 +00:00
tap.start();