You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
expect(fakeImpressionsCache.track.mock.calls[0][0]).toEqual([imp1,imp2]);// Should call the storage track method once we invoke .track() method, passing impressions with `track` enabled
71
69
});
72
70
73
-
test('Tracked impressions should be sent to impression listener and integration manager when we invoke .track()',(done)=>{
expect(fakeListener.logImpression).not.toBeCalled();// The listener should not be executed synchronously.
95
93
expect(fakeIntegrationsManager.handleImpression).not.toBeCalled();// The integrations manager handleImpression method should not be executed synchronously.
96
94
97
-
setTimeout(()=>{
98
-
expect(fakeListener.logImpression).toBeCalledTimes(2);// The listener should be executed after the timeout wrapping make it to the queue stack, once per each tracked impression.
99
-
expect(fakeIntegrationsManager.handleImpression).toBeCalledTimes(2);// The integrations manager handleImpression method should be executed after the timeout wrapping make it to the queue stack, once per each tracked impression.
expect(fakeListener.logImpression).toBeCalledTimes(2);// The listener should be executed after the timeout wrapping make it to the queue stack, once per each tracked impression.
98
+
expect(fakeIntegrationsManager.handleImpression).toBeCalledTimes(2);// The integrations manager handleImpression method should be executed after the timeout wrapping make it to the queue stack, once per each tracked impression.
103
99
104
-
expect(fakeListener.logImpression.mock.calls[0][0]).toEqual(impressionData1);// The listener should be executed with the corresponding map for each of the impressions.
105
-
expect(fakeListener.logImpression.mock.calls[1][0]).toEqual(impressionData2);// The listener should be executed with the corresponding map for each of the impressions.
106
-
expect(fakeListener.logImpression.mock.calls[0][0].impression).not.toBe(fakeImpression);// but impression should be a copy
107
-
expect(fakeListener.logImpression.mock.calls[1][0].impression).not.toBe(fakeImpression2);// but impression should be a copy
expect(fakeIntegrationsManager.handleImpression.mock.calls[0][0]).toEqual(impressionData1);// The integration manager handleImpression method should be executed with the corresponding map for each of the impressions.
110
-
expect(fakeIntegrationsManager.handleImpression.mock.calls[1][0]).toEqual(impressionData2);// The integration manager handleImpression method should be executed with the corresponding map for each of the impressions.
111
-
expect(fakeIntegrationsManager.handleImpression.mock.calls[0][0].impression).not.toBe(fakeImpression);// but impression should be a copy
112
-
expect(fakeIntegrationsManager.handleImpression.mock.calls[1][0].impression).not.toBe(fakeImpression2);// but impression should be a copy
103
+
expect(fakeListener.logImpression.mock.calls[0][0]).toEqual(impressionData1);// The listener should be executed with the corresponding map for each of the impressions.
104
+
expect(fakeListener.logImpression.mock.calls[1][0]).toEqual(impressionData2);// The listener should be executed with the corresponding map for each of the impressions.
105
+
expect(fakeListener.logImpression.mock.calls[0][0].impression).not.toBe(fakeImpression);// but impression should be a copy
106
+
expect(fakeListener.logImpression.mock.calls[1][0].impression).not.toBe(fakeImpression2);// but impression should be a copy
113
107
114
-
done();
115
-
},0);
108
+
expect(fakeIntegrationsManager.handleImpression.mock.calls[0][0]).toEqual(impressionData1);// The integration manager handleImpression method should be executed with the corresponding map for each of the impressions.
109
+
expect(fakeIntegrationsManager.handleImpression.mock.calls[1][0]).toEqual(impressionData2);// The integration manager handleImpression method should be executed with the corresponding map for each of the impressions.
110
+
expect(fakeIntegrationsManager.handleImpression.mock.calls[0][0].impression).not.toBe(fakeImpression);// but impression should be a copy
111
+
expect(fakeIntegrationsManager.handleImpression.mock.calls[1][0].impression).not.toBe(fakeImpression2);// but impression should be a copy
0 commit comments