Skip to content

Commit ae495ae

Browse files
Resolved merge conflicts
1 parent cd8e283 commit ae495ae

7 files changed

Lines changed: 11 additions & 35 deletions

File tree

src/App.jsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ export const App = () => {
2323
const hasNetworkFailure = !masqueradeUser && isError;
2424
const supportEmail = data?.platformSettings?.supportEmail || undefined;
2525

26-
/* istanbul ignore next */
27-
const { masqueradeUser } = useMasquerade();
28-
const { data, isError } = useInitializeLearnerHome();
29-
const hasNetworkFailure = !masqueradeUser && isError;
30-
const supportEmail = data?.platformSettings?.supportEmail || undefined;
31-
3226
/* istanbul ignore next */
3327
React.useEffect(() => {
3428
if (getConfig().HOTJAR_APP_ID) {

src/App.test.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jest.mock('data/context', () => ({
1717

1818
jest.mock('containers/Dashboard', () => jest.fn(() => <div>Dashboard</div>));
1919
jest.mock('containers/LearnerDashboardHeader', () => jest.fn(() => <div>LearnerDashboardHeader</div>));
20-
jest.mock('containers/AppWrapper', () => jest.fn(({ children }) => <div className="AppWrapper">{children}</div>));
2120

2221
jest.mock('@edx/frontend-platform', () => ({
2322
getConfig: jest.fn(() => ({})),

src/containers/AppWrapper/index.test.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/containers/ProgramDashboard/ProgramsList/index.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import { IntlProvider } from '@edx/frontend-platform/i18n';
44
import { logError } from '@edx/frontend-platform/logging';
55

66
import ProgramsList from '.';
7-
import { getProgramsListData } from '../data/api';
7+
import { useProgramsListData } from '../data/api';
88
import ProgramListCard from './ProgramListCard';
99
import ExploreProgramsCTA from './ExploreProgramsCTA';
1010
import messages from './messages';
1111

1212
// Mock API and external utilities
1313
jest.mock('../data/api', () => ({
14-
getProgramsListData: jest.fn(),
14+
useProgramsListData: jest.fn(),
1515
}));
1616
jest.mock('@edx/frontend-platform/logging', () => ({
1717
logError: jest.fn(),
@@ -40,7 +40,7 @@ describe('ProgramsList', () => {
4040
beforeEach(() => {
4141
jest.clearAllMocks();
4242
// Set up a successful mock API response by default
43-
(getProgramsListData as jest.Mock).mockResolvedValue(mockApiData);
43+
(useProgramsListData as jest.Mock).mockResolvedValue(mockApiData);
4444
});
4545

4646
const renderComponent = () => render(
@@ -60,7 +60,7 @@ describe('ProgramsList', () => {
6060
it('fetches program data on mount', async () => {
6161
renderComponent();
6262

63-
expect(getProgramsListData).toHaveBeenCalledTimes(1);
63+
expect(useProgramsListData).toHaveBeenCalledTimes(1);
6464
});
6565

6666
it('renders ProgramListCard components upon successful API response', async () => {
@@ -90,7 +90,7 @@ describe('ProgramsList', () => {
9090
});
9191

9292
it('renders the ExploreProgramsCTA with "hasEnrollments" set to false if there are no program enrollments', async () => {
93-
(getProgramsListData as jest.Mock).mockResolvedValueOnce({ data: [] });
93+
(useProgramsListData as jest.Mock).mockResolvedValueOnce({ data: [] });
9494
renderComponent();
9595

9696
await waitFor(() => {
@@ -107,7 +107,7 @@ describe('ProgramsList', () => {
107107

108108
it('calls logError if the API request fails', async () => {
109109
const mockError = new Error('Network failed');
110-
(getProgramsListData as jest.Mock).mockRejectedValue(mockError);
110+
(useProgramsListData as jest.Mock).mockRejectedValue(mockError);
111111

112112
const mockContactUrl = 'mock-contact-url';
113113

src/containers/ProgramDashboard/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
22
import { getConfig } from '@edx/frontend-platform';
33

4-
export async function getProgramsListData() {
4+
export async function useProgramsListData() {
55
const url = `${getConfig().LMS_BASE_URL}/api/dashboard/v0/programs/`;
66
const response = await getAuthenticatedHttpClient().get(url);
77
return response;

src/containers/ProgramDashboard/data/api.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
2-
import { getProgramsListData } from './api';
2+
import { useProgramsListData } from './api';
33

44
const mockGet = jest.fn(() => ({
55
data: {},
@@ -19,7 +19,7 @@ jest.mock('@edx/frontend-platform', () => ({
1919

2020
describe('API', () => {
2121
it('uses the expected URL to call the endpoint', async () => {
22-
await getProgramsListData();
22+
await useProgramsListData();
2323

2424
expect(getAuthenticatedHttpClient).toHaveBeenCalled();
2525
expect(mockGet).toHaveBeenCalledWith(`${mockLMSBaseUrl}/api/dashboard/v0/programs/`);

src/index.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import { FooterSlot } from '@edx/frontend-component-footer';
2626
import LearnerDashboardHeader from 'containers/LearnerDashboardHeader';
2727
import { ProgramsList } from './containers/ProgramDashboard';
2828

29-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
30-
import ContextProviders from 'data/context';
3129
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
3230
import ContextProviders from 'data/context';
3331
import { configuration } from './config';
@@ -55,9 +53,9 @@ subscribe(APP_READY, () => {
5553
<LearnerDashboardHeader />
5654
<Routes>
5755
<Route path="/" element={<PageWrap><App /></PageWrap>} />
58-
{getConfig().ENABLE_PROGRAM_DASHBOARD && (
56+
{/* {getConfig().ENABLE_PROGRAM_DASHBOARD && ( */}
5957
<Route path="programs" element={<PageWrap><ProgramsList /></PageWrap>} />
60-
)}
58+
{/* )} */}
6159
<Route path="*" element={<Navigate to="/" replace />} />
6260
</Routes>
6361
</QueryClientProvider>

0 commit comments

Comments
 (0)