Fix: More tracking fixes (#82)
This commit is contained in:
@@ -21,7 +21,16 @@ exports[`app registry subscribe: APP_READY. links App to root element 1`] = `
|
||||
}
|
||||
}
|
||||
>
|
||||
<App />
|
||||
<Switch>
|
||||
<PageRoute
|
||||
path="/courses"
|
||||
>
|
||||
<App />
|
||||
</PageRoute>
|
||||
<Redirect
|
||||
to="/courses"
|
||||
/>
|
||||
</Switch>
|
||||
</AppProvider>
|
||||
</IntlProvider>
|
||||
`;
|
||||
|
||||
@@ -16,9 +16,9 @@ export const useEnterpriseDashboardHook = () => {
|
||||
const [showModal, setShowModal] = module.state.showModal(true);
|
||||
const dashboard = appHooks.useEnterpriseDashboardData();
|
||||
|
||||
const trackOpened = () => modalOpened(dashboard.enterpriseUUID);
|
||||
const trackClose = () => modalClosed(dashboard.enterpriseUUID, 'Cancel button');
|
||||
const trackEscape = () => modalClosed(dashboard.enterpriseUUID, 'Escape');
|
||||
const trackOpened = modalOpened(dashboard.enterpriseUUID);
|
||||
const trackClose = modalClosed(dashboard.enterpriseUUID, 'Cancel button');
|
||||
const trackEscape = modalClosed(dashboard.enterpriseUUID, 'Escape');
|
||||
|
||||
const handleCTAClick = () => {
|
||||
modalCTAClicked(dashboard.enterpriseUUID, dashboard.url);
|
||||
|
||||
@@ -9,16 +9,24 @@ jest.mock('data/redux', () => ({
|
||||
useEnterpriseDashboardData: jest.fn(),
|
||||
},
|
||||
}));
|
||||
jest.mock('tracking', () => ({
|
||||
__esModule: true,
|
||||
default: {
|
||||
enterpriseDashboard: {
|
||||
modalOpened: jest.fn(),
|
||||
modalClosed: jest.fn(),
|
||||
modalCTAClicked: jest.fn(),
|
||||
jest.mock('tracking', () => {
|
||||
const modalOpenedEvent = jest.fn();
|
||||
const modalClosedEvent = jest.fn();
|
||||
const modalCTAClickedEvent = jest.fn();
|
||||
return {
|
||||
__esModule: true,
|
||||
default: {
|
||||
enterpriseDashboard: {
|
||||
modalOpenedEvent,
|
||||
modalClosedEvent,
|
||||
modalCTAClickedEvent,
|
||||
modalOpened: jest.fn(() => modalOpenedEvent),
|
||||
modalClosed: jest.fn(() => modalClosedEvent),
|
||||
modalCTAClicked: jest.fn(() => modalCTAClickedEvent),
|
||||
},
|
||||
},
|
||||
},
|
||||
}));
|
||||
};
|
||||
});
|
||||
|
||||
const state = new MockUseState(hooks);
|
||||
|
||||
|
||||
@@ -4,8 +4,13 @@ import 'regenerator-runtime/runtime';
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { AppProvider, ErrorPage } from '@edx/frontend-platform/react';
|
||||
import { Switch, Redirect } from 'react-router-dom';
|
||||
|
||||
import {
|
||||
AppProvider,
|
||||
ErrorPage,
|
||||
PageRoute,
|
||||
} from '@edx/frontend-platform/react';
|
||||
import store from 'data/store';
|
||||
import {
|
||||
APP_READY,
|
||||
@@ -16,7 +21,6 @@ import {
|
||||
} from '@edx/frontend-platform';
|
||||
|
||||
import { messages as footerMessages } from '@edx/frontend-component-footer';
|
||||
|
||||
import { IntlProvider } from '@edx/frontend-platform/i18n';
|
||||
import { configuration } from './config';
|
||||
|
||||
@@ -28,7 +32,12 @@ subscribe(APP_READY, () => {
|
||||
ReactDOM.render(
|
||||
<IntlProvider locale="en">
|
||||
<AppProvider store={store}>
|
||||
<App />
|
||||
<Switch>
|
||||
<PageRoute path="/courses">
|
||||
<App />
|
||||
</PageRoute>
|
||||
<Redirect to="/courses" />
|
||||
</Switch>
|
||||
</AppProvider>
|
||||
</IntlProvider>,
|
||||
document.getElementById('root'),
|
||||
|
||||
@@ -71,6 +71,10 @@ jest.mock('@edx/frontend-platform/auth', () => ({
|
||||
getLoginRedirectUrl: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('@edx/frontend-platform/analytics', () => ({
|
||||
sendTrackEvent: jest.fn(),
|
||||
}));
|
||||
|
||||
const configureStore = () => redux.createStore(
|
||||
reducers,
|
||||
redux.compose(redux.applyMiddleware(thunk)),
|
||||
|
||||
Reference in New Issue
Block a user