smartanalytics/test/test.ts

28 lines
671 B
TypeScript
Raw Normal View History

2017-08-23 12:55:11 +00:00
import { expect, tap } from 'tapbundle'
2017-02-24 02:00:15 +00:00
2017-08-23 12:55:11 +00:00
import * as smartanalytics from '../ts/index'
2017-02-24 02:00:15 +00:00
2017-08-23 12:55:11 +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',
apiEndPoint: 'https://pubapi-1.lossless.one/analytics'
2017-02-24 02:00:15 +00:00
})
2017-08-23 12:55:11 +00:00
})
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'
2017-08-23 12:55:11 +00:00
})
2017-08-23 15:33:30 +00:00
await testAnalytics.recordEvent('sandbox', {
2017-08-23 12:55:11 +00:00
someValue: 'someData'
})
}
doit()
2017-02-24 02:00:15 +00:00
})
2017-08-23 12:55:11 +00:00
tap.start()