@@ -77,9 +77,6 @@ describe('FirebaseAnalytics instance tests', () => {
77
77
delete window [ 'dataLayer' ] ;
78
78
removeGtagScript ( ) ;
79
79
} ) ;
80
- afterEach ( ( ) => {
81
- gtagStub . reset ( ) ;
82
- } ) ;
83
80
it ( 'Contains reference to parent app' , ( ) => {
84
81
expect ( analyticsInstance . app ) . to . equal ( app ) ;
85
82
} ) ;
@@ -91,6 +88,7 @@ describe('FirebaseAnalytics instance tests', () => {
91
88
// For IE: Need then() or else "expect" runs immediately on FID resolve
92
89
// before the other statements in initializeGAId.
93
90
await fidDeferred . promise . then ( ) ;
91
+ console . log ( 'callCount' , gtagStub . callCount ) ;
94
92
expect ( gtagStub ) . to . have . been . calledWith ( 'js' ) ;
95
93
expect ( gtagStub ) . to . have . been . calledWith (
96
94
GtagCommand . CONFIG ,
@@ -113,6 +111,7 @@ describe('FirebaseAnalytics instance tests', () => {
113
111
currency : 'USD'
114
112
}
115
113
) ;
114
+ gtagStub . reset ( ) ;
116
115
} ) ;
117
116
it ( 'setCurrentScreen() method exists on instance' , ( ) => {
118
117
expect ( analyticsInstance . setCurrentScreen ) . to . be . instanceOf ( Function ) ;
@@ -152,11 +151,8 @@ describe('FirebaseAnalytics instance tests', () => {
152
151
delete window [ customDataLayerName ] ;
153
152
removeGtagScript ( ) ;
154
153
} ) ;
155
- afterEach ( ( ) => {
156
- gtagStub . reset ( ) ;
157
- } ) ;
158
154
it ( 'Calls gtag correctly on logEvent (instance)' , async ( ) => {
159
- analyticsInstance . logEvent ( EventName . ADD_PAYMENT_INFO , {
155
+ analyticsInstance . logEvent ( EventName . ADD_SHIPPING_INFO , {
160
156
currency : 'USD'
161
157
} ) ;
162
158
// Clear event stack of async FID call.
@@ -178,12 +174,13 @@ describe('FirebaseAnalytics instance tests', () => {
178
174
await Promise . all ( Object . values ( initializedIdPromisesMap ) ) ;
179
175
expect ( gtagStub ) . to . have . been . calledWith (
180
176
GtagCommand . EVENT ,
181
- EventName . ADD_PAYMENT_INFO ,
177
+ EventName . ADD_SHIPPING_INFO ,
182
178
{
183
179
'send_to' : 'abcd-efgh' ,
184
180
currency : 'USD'
185
181
}
186
182
) ;
183
+ gtagStub . reset ( ) ;
187
184
} ) ;
188
185
} ) ;
189
186
0 commit comments