summaryrefslogtreecommitdiff
path: root/spec/frontend/tracking_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/tracking_spec.js')
-rw-r--r--spec/frontend/tracking_spec.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/frontend/tracking_spec.js b/spec/frontend/tracking_spec.js
index 964f8b8787e..d9cc7104139 100644
--- a/spec/frontend/tracking_spec.js
+++ b/spec/frontend/tracking_spec.js
@@ -11,6 +11,7 @@ describe('Tracking', () => {
namespace: '_namespace_',
hostname: 'app.gitfoo.com',
cookieDomain: '.gitfoo.com',
+ userId: null,
};
snowplowSpy = jest.spyOn(window, 'snowplow');
});
@@ -34,6 +35,7 @@ describe('Tracking', () => {
contexts: { webPage: true },
formTracking: false,
linkClickTracking: false,
+ userId: null,
});
});
@@ -41,15 +43,18 @@ describe('Tracking', () => {
initUserTracking();
expect(snowplowSpy).toHaveBeenCalledWith('enableActivityTracking', 30, 30);
expect(snowplowSpy).toHaveBeenCalledWith('trackPageView');
+ expect(snowplowSpy).not.toHaveBeenCalledWith('setUserId');
expect(snowplowSpy).not.toHaveBeenCalledWith('enableFormTracking');
expect(snowplowSpy).not.toHaveBeenCalledWith('enableLinkClickTracking');
window.snowplowOptions = Object.assign({}, window.snowplowOptions, {
formTracking: true,
linkClickTracking: true,
+ userId: '1',
});
initUserTracking();
+ expect(snowplowSpy).toHaveBeenCalledWith('setUserId', '1');
expect(snowplowSpy).toHaveBeenCalledWith('enableFormTracking');
expect(snowplowSpy).toHaveBeenCalledWith('enableLinkClickTracking');
});