smartanalytics/test/test.ts

28 lines
680 B
TypeScript
Raw Permalink 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-24 14:56:04 +00:00
projectIdArg: 'sandbox',
2017-08-23 12:55:11 +00:00
appNameArg: 'smartanalytics',
2017-08-23 23:06:09 +00:00
apiEndPointArg: '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()