smartanalytics/test/test.ts

28 lines
691 B
TypeScript
Raw Normal View History

2018-10-28 22:29:45 +00:00
import { expect, tap } from '@pushrocks/tapbundle';
2017-02-24 02:00:15 +00:00
2018-10-28 22:29:45 +00:00
import * as smartanalytics from '../ts/index';
2017-02-24 02:00:15 +00:00
2018-10-28 22:29:45 +00:00
let testAnalytics: smartanalytics.Analytics;
2017-02-24 02:00:15 +00:00
2017-08-23 12:55:11 +00:00
tap.test('should create a valid AnalyticsAccount', async () => {
testAnalytics = new smartanalytics.Analytics({
2017-08-29 13:18:10 +00:00
projectId: 'sandbox',
appName: 'smartanalytics',
2018-10-28 22:29:45 +00:00
apiEndPoint: 'https://pubapi.lossless.one/analytics'
});
});
2017-02-24 02:00:15 +00:00
2017-08-24 14:56:04 +00:00
tap.test('should send a request to Lossless API endpoint', async () => {
2017-08-23 12:55:11 +00:00
let doit = async () => {
2017-08-23 15:33:30 +00:00
await testAnalytics.recordEvent('sandbox', {
2017-08-24 14:56:04 +00:00
trackingPurpose: 'test'
2018-10-28 22:29:45 +00:00
});
2017-08-23 15:33:30 +00:00
await testAnalytics.recordEvent('sandbox', {
2017-08-23 12:55:11 +00:00
someValue: 'someData'
2018-10-28 22:29:45 +00:00
});
};
doit();
});
2017-08-23 12:55:11 +00:00
2018-10-28 22:29:45 +00:00
tap.start();