smartanalytics/test/test.ts

28 lines
675 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-23 23:06:09 +00:00
projectIdArg: 'pushrocks',
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-23 12:55:11 +00:00
tap.test('should send a request to Google Analytics', async () => {
let doit = async () => {
2017-08-23 15:33:30 +00:00
await testAnalytics.recordEvent('sandbox', {
someValue: 'someData'
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()