@@ -30,8 +30,8 @@ describe('integration', () => {
3030 if ( postData ) {
3131 postData = JSON . parse ( postData )
3232 }
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 )
3535 } , 10000 )
3636
3737 it ( 'sends page context with url, title, and referrer' , async ( ) => {
@@ -42,7 +42,7 @@ describe('integration', () => {
4242 await page . goto ( home )
4343 await page . click ( 'button#count-button' )
4444 postData = postData && JSON . parse ( postData )
45- expect ( postData . context ) . toMatchObject ( {
45+ expect ( postData . data . context ) . toMatchObject ( {
4646 url : await page . url ( ) ,
4747 title : await page . title ( ) ,
4848 referrer : '' ,
@@ -51,7 +51,7 @@ describe('integration', () => {
5151 await Promise . all ( [ page . waitForNavigation ( ) , page . click ( 'a' ) ] )
5252 await page . click ( 'button#send-button' )
5353 postData = postData && JSON . parse ( postData )
54- expect ( postData . context ) . toMatchObject ( {
54+ expect ( postData . data . context ) . toMatchObject ( {
5555 url : await page . url ( ) ,
5656 title : await page . title ( ) ,
5757 referrer : expect . stringMatching ( SERVER_URL ) ,
@@ -108,27 +108,27 @@ describe('integration', () => {
108108 await page . type ( 'input#user-input' , userId )
109109 await page . click ( 'button#login-button' )
110110 postData = postData && JSON . parse ( postData )
111- expect ( postData . user ) . toMatchObject ( { id : userId } )
111+ expect ( postData . data . user ) . toMatchObject ( { id : userId } )
112112 postData = undefined // reset for next page
113113
114114 // visit the other page, should persist userId
115115 await Promise . all ( [ page . waitForNavigation ( ) , page . click ( 'a' ) ] )
116116 await page . click ( 'button#send-button' )
117117 postData = postData && JSON . parse ( postData )
118- expect ( postData . user ) . toMatchObject ( { id : userId } )
118+ expect ( postData . data . user ) . toMatchObject ( { id : userId } )
119119 postData = undefined
120120
121121 // do logout, ensure logout sent event does NOT have user id
122122 await page . click ( '#logout-button' )
123123 postData = postData && JSON . parse ( postData )
124- expect ( postData . user ) . toMatchObject ( { id : '' } )
124+ expect ( postData . data . user ) . toMatchObject ( { id : '' } )
125125 postData = undefined
126126
127127 // go back and send event from home page, should NOT have user id
128128 await page . goBack ( )
129129 await page . click ( '#count-button' )
130130 postData = postData && JSON . parse ( postData )
131- expect ( postData . user ) . toMatchObject ( { id : '' } )
131+ expect ( postData . data . user ) . toMatchObject ( { id : '' } )
132132 } , 20000 )
133133
134134 it ( 'persists user id when coming back to site' , async ( ) => {
@@ -145,7 +145,7 @@ describe('integration', () => {
145145 await page . type ( 'input#user-input' , userId )
146146 await page . click ( 'button#login-button' )
147147 postData = postData && JSON . parse ( postData )
148- expect ( postData . user ) . toMatchObject ( { id : userId } )
148+ expect ( postData . data . user ) . toMatchObject ( { id : userId } )
149149 postData = undefined // reset for next page
150150
151151 // visit the other page, should persist userId
@@ -154,7 +154,7 @@ describe('integration', () => {
154154 await page . goto ( alt )
155155 await page . click ( 'button#send-button' )
156156 postData = postData && JSON . parse ( postData )
157- expect ( postData . user ) . toMatchObject ( { id : userId } )
157+ expect ( postData . data . user ) . toMatchObject ( { id : userId } )
158158 } , 8000 )
159159
160160 it ( 'calls template functions onIdentify and onUnidentify' , async ( ) => {
0 commit comments