Skip to content

Commit 04d1533

Browse files
committed
Figure out failing test
1 parent 29327b2 commit 04d1533

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

packages/analytics/index.test.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ describe('FirebaseAnalytics instance tests', () => {
7777
delete window['dataLayer'];
7878
removeGtagScript();
7979
});
80-
afterEach(() => {
81-
gtagStub.reset();
82-
});
8380
it('Contains reference to parent app', () => {
8481
expect(analyticsInstance.app).to.equal(app);
8582
});
@@ -91,6 +88,7 @@ describe('FirebaseAnalytics instance tests', () => {
9188
// For IE: Need then() or else "expect" runs immediately on FID resolve
9289
// before the other statements in initializeGAId.
9390
await fidDeferred.promise.then();
91+
console.log('callCount', gtagStub.callCount);
9492
expect(gtagStub).to.have.been.calledWith('js');
9593
expect(gtagStub).to.have.been.calledWith(
9694
GtagCommand.CONFIG,
@@ -113,6 +111,7 @@ describe('FirebaseAnalytics instance tests', () => {
113111
currency: 'USD'
114112
}
115113
);
114+
gtagStub.reset();
116115
});
117116
it('setCurrentScreen() method exists on instance', () => {
118117
expect(analyticsInstance.setCurrentScreen).to.be.instanceOf(Function);
@@ -152,11 +151,8 @@ describe('FirebaseAnalytics instance tests', () => {
152151
delete window[customDataLayerName];
153152
removeGtagScript();
154153
});
155-
afterEach(() => {
156-
gtagStub.reset();
157-
});
158154
it('Calls gtag correctly on logEvent (instance)', async () => {
159-
analyticsInstance.logEvent(EventName.ADD_PAYMENT_INFO, {
155+
analyticsInstance.logEvent(EventName.ADD_SHIPPING_INFO, {
160156
currency: 'USD'
161157
});
162158
// Clear event stack of async FID call.
@@ -178,12 +174,13 @@ describe('FirebaseAnalytics instance tests', () => {
178174
await Promise.all(Object.values(initializedIdPromisesMap));
179175
expect(gtagStub).to.have.been.calledWith(
180176
GtagCommand.EVENT,
181-
EventName.ADD_PAYMENT_INFO,
177+
EventName.ADD_SHIPPING_INFO,
182178
{
183179
'send_to': 'abcd-efgh',
184180
currency: 'USD'
185181
}
186182
);
183+
gtagStub.reset();
187184
});
188185
});
189186

0 commit comments

Comments
 (0)