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({
|
|
|
|
projectArg: 'pushrocks',
|
|
|
|
appNameArg: 'smartanalytics',
|
2017-08-23 15:33:30 +00:00
|
|
|
apiEndPointArg: 'https://pubapi-1.herokuapp.com/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()
|