@@ -30,8 +30,8 @@ describe('integration', () => {
30
30
if ( postData ) {
31
31
postData = JSON . parse ( postData )
32
32
}
33
- expect ( postData . streamName ) . toMatch ( 'clickstream' )
34
- expect ( postData . eventTimestamp ) . toBeGreaterThan ( 15e9 )
33
+ expect ( postData . stream ) . toMatch ( 'clickstream' )
34
+ expect ( postData . data . timestamp ) . toBeGreaterThan ( 15e9 )
35
35
} , 10000 )
36
36
37
37
it ( 'sends page context with url, title, and referrer' , async ( ) => {
@@ -42,7 +42,7 @@ describe('integration', () => {
42
42
await page . goto ( home )
43
43
await page . click ( 'button#count-button' )
44
44
postData = postData && JSON . parse ( postData )
45
- expect ( postData . context ) . toMatchObject ( {
45
+ expect ( postData . data . context ) . toMatchObject ( {
46
46
url : await page . url ( ) ,
47
47
title : await page . title ( ) ,
48
48
referrer : '' ,
@@ -51,7 +51,7 @@ describe('integration', () => {
51
51
await Promise . all ( [ page . waitForNavigation ( ) , page . click ( 'a' ) ] )
52
52
await page . click ( 'button#send-button' )
53
53
postData = postData && JSON . parse ( postData )
54
- expect ( postData . context ) . toMatchObject ( {
54
+ expect ( postData . data . context ) . toMatchObject ( {
55
55
url : await page . url ( ) ,
56
56
title : await page . title ( ) ,
57
57
referrer : expect . stringMatching ( SERVER_URL ) ,
@@ -108,27 +108,27 @@ describe('integration', () => {
108
108
await page . type ( 'input#user-input' , userId )
109
109
await page . click ( 'button#login-button' )
110
110
postData = postData && JSON . parse ( postData )
111
- expect ( postData . user ) . toMatchObject ( { id : userId } )
111
+ expect ( postData . data . user ) . toMatchObject ( { id : userId } )
112
112
postData = undefined // reset for next page
113
113
114
114
// visit the other page, should persist userId
115
115
await Promise . all ( [ page . waitForNavigation ( ) , page . click ( 'a' ) ] )
116
116
await page . click ( 'button#send-button' )
117
117
postData = postData && JSON . parse ( postData )
118
- expect ( postData . user ) . toMatchObject ( { id : userId } )
118
+ expect ( postData . data . user ) . toMatchObject ( { id : userId } )
119
119
postData = undefined
120
120
121
121
// do logout, ensure logout sent event does NOT have user id
122
122
await page . click ( '#logout-button' )
123
123
postData = postData && JSON . parse ( postData )
124
- expect ( postData . user ) . toMatchObject ( { id : '' } )
124
+ expect ( postData . data . user ) . toMatchObject ( { id : '' } )
125
125
postData = undefined
126
126
127
127
// go back and send event from home page, should NOT have user id
128
128
await page . goBack ( )
129
129
await page . click ( '#count-button' )
130
130
postData = postData && JSON . parse ( postData )
131
- expect ( postData . user ) . toMatchObject ( { id : '' } )
131
+ expect ( postData . data . user ) . toMatchObject ( { id : '' } )
132
132
} , 20000 )
133
133
134
134
it ( 'persists user id when coming back to site' , async ( ) => {
@@ -145,7 +145,7 @@ describe('integration', () => {
145
145
await page . type ( 'input#user-input' , userId )
146
146
await page . click ( 'button#login-button' )
147
147
postData = postData && JSON . parse ( postData )
148
- expect ( postData . user ) . toMatchObject ( { id : userId } )
148
+ expect ( postData . data . user ) . toMatchObject ( { id : userId } )
149
149
postData = undefined // reset for next page
150
150
151
151
// visit the other page, should persist userId
@@ -154,7 +154,7 @@ describe('integration', () => {
154
154
await page . goto ( alt )
155
155
await page . click ( 'button#send-button' )
156
156
postData = postData && JSON . parse ( postData )
157
- expect ( postData . user ) . toMatchObject ( { id : userId } )
157
+ expect ( postData . data . user ) . toMatchObject ( { id : userId } )
158
158
} , 8000 )
159
159
160
160
it ( 'calls template functions onIdentify and onUnidentify' , async ( ) => {
0 commit comments