fix: make identify call to pass missing user_id (#774)
This commit is contained in:
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import { getConfig, snakeCaseObject } from '@edx/frontend-platform';
|
import { getConfig, snakeCaseObject } from '@edx/frontend-platform';
|
||||||
import { sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics';
|
import { identifyAuthenticatedUser, sendPageEvent, sendTrackEvent } from '@edx/frontend-platform/analytics';
|
||||||
import {
|
import {
|
||||||
AxiosJwtAuthService,
|
AxiosJwtAuthService,
|
||||||
configure as configureAuth,
|
configure as configureAuth,
|
||||||
@@ -64,9 +64,10 @@ const ProgressiveProfiling = (props) => {
|
|||||||
|
|
||||||
if (registrationResponse) {
|
if (registrationResponse) {
|
||||||
setRegistrationResult(registrationResponse);
|
setRegistrationResult(registrationResponse);
|
||||||
|
identifyAuthenticatedUser(authenticatedUser?.userId);
|
||||||
sendPageEvent('login_and_registration', 'welcome');
|
sendPageEvent('login_and_registration', 'welcome');
|
||||||
}
|
}
|
||||||
}, [DASHBOARD_URL, registrationResponse]);
|
}, [authenticatedUser, DASHBOARD_URL, registrationResponse]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (registrationResponse) {
|
if (registrationResponse) {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ jest.mock('@edx/frontend-platform/logging');
|
|||||||
|
|
||||||
analytics.sendTrackEvent = jest.fn();
|
analytics.sendTrackEvent = jest.fn();
|
||||||
analytics.sendPageEvent = jest.fn();
|
analytics.sendPageEvent = jest.fn();
|
||||||
|
analytics.identifyAuthenticatedUser = jest.fn();
|
||||||
logging.getLoggingService = jest.fn();
|
logging.getLoggingService = jest.fn();
|
||||||
|
|
||||||
auth.configure = jest.fn();
|
auth.configure = jest.fn();
|
||||||
@@ -127,6 +128,11 @@ describe('ProgressiveProfilingTests', () => {
|
|||||||
expect(progressiveProfilingPage.find('#gender').exists()).toBeTruthy();
|
expect(progressiveProfilingPage.find('#gender').exists()).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should make identify call to segment on progressive profiling page', async () => {
|
||||||
|
await getProgressiveProfilingPage();
|
||||||
|
expect(analytics.identifyAuthenticatedUser).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
it('should submit user profile details on form submission', async () => {
|
it('should submit user profile details on form submission', async () => {
|
||||||
auth.getAuthenticatedUser = jest.fn(() => ({ userId: 3, username: 'abc123' }));
|
auth.getAuthenticatedUser = jest.fn(() => ({ userId: 3, username: 'abc123' }));
|
||||||
const formPayload = {
|
const formPayload = {
|
||||||
|
|||||||
Reference in New Issue
Block a user