Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("calls analytics#identify with user email in args ", () => {
const analyticsIdentifyFn = sandbox.stub(Analytics.prototype, "identify");
const clusterId = "cluster-1";
const email = "foo@bar.com";
const action = signUpForEmailSubscription(clusterId, email);
return expectSaga(signUpEmailSubscription, action)
.dispatch(action)
.run()
.then(() => {
const expectedAnalyticsMessage = {
userId: clusterId,
traits: {
email,
},
};
analyticsIdentifyFn.calledOnceWith(expectedAnalyticsMessage);
});