Skip to content

Commit ae08970

Browse files
committed
fix: requested changes
1 parent f42207b commit ae08970

2 files changed

Lines changed: 6 additions & 30 deletions

File tree

src/App.test.jsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,13 @@ reduxHooks.usePlatformSettingsData.mockReturnValue({ supportEmail });
4040

4141
describe('App router component', () => {
4242
describe('component', () => {
43-
const runBasicTests = () => {
44-
it('displays title in helmet component', async () => {
45-
await waitFor(() => expect(document.title).toEqual(messages.pageTitle.defaultMessage));
46-
});
47-
};
4843
describe('no network failure', () => {
4944
beforeEach(() => {
5045
jest.clearAllMocks();
5146
reduxHooks.useRequestIsFailed.mockReturnValue(false);
5247
getConfig.mockReturnValue({});
5348
render(<IntlProvider locale="en"><App /></IntlProvider>);
5449
});
55-
runBasicTests();
5650
it('loads dashboard', () => {
5751
const dashboard = screen.getByText('Dashboard');
5852
expect(dashboard).toBeInTheDocument();
@@ -65,7 +59,6 @@ describe('App router component', () => {
6559
getConfig.mockReturnValue({ OPTIMIZELY_URL: 'fake.url' });
6660
render(<IntlProvider locale="en"><App /></IntlProvider>);
6761
});
68-
runBasicTests();
6962
it('loads dashboard', () => {
7063
const dashboard = screen.getByText('Dashboard');
7164
expect(dashboard).toBeInTheDocument();
@@ -78,7 +71,6 @@ describe('App router component', () => {
7871
getConfig.mockReturnValue({ OPTIMIZELY_PROJECT_ID: 'fakeId' });
7972
render(<IntlProvider locale="en"><App /></IntlProvider>);
8073
});
81-
runBasicTests();
8274
it('loads dashboard', () => {
8375
const dashboard = screen.getByText('Dashboard');
8476
expect(dashboard).toBeInTheDocument();
@@ -91,7 +83,6 @@ describe('App router component', () => {
9183
getConfig.mockReturnValue({});
9284
render(<IntlProvider locale="en" messages={messages}><App /></IntlProvider>);
9385
});
94-
runBasicTests();
9586
it('loads error page', () => {
9687
const alert = screen.getByRole('alert');
9788
expect(alert).toBeInTheDocument();
@@ -105,7 +96,6 @@ describe('App router component', () => {
10596
getConfig.mockReturnValue({});
10697
render(<IntlProvider locale="en"><App /></IntlProvider>);
10798
});
108-
runBasicTests();
10999
it('loads error page', () => {
110100
const alert = screen.getByRole('alert');
111101
expect(alert).toBeInTheDocument();

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

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,10 @@ jest.mock('./ExploreProgramsCTA', () => jest.fn(() => (
3131
)));
3232

3333
// Mock Data
34-
const mockApiData = {
35-
data: [
36-
{ uuid: '111-aaa', title: 'Data Science Program' },
37-
{ uuid: '222-bbb', title: 'UX Design Program' },
38-
],
39-
};
40-
41-
const mockExtractedData = mockApiData.data.map(item => ({
42-
...item,
43-
}));
34+
const mockApiData = [
35+
{ uuid: '111-aaa', title: 'Data Science Program' },
36+
{ uuid: '222-bbb', title: 'UX Design Program' },
37+
];
4438

4539
describe('ProgramsList', () => {
4640
beforeEach(() => {
@@ -55,14 +49,6 @@ describe('ProgramsList', () => {
5549
</IntlProvider>,
5650
);
5751

58-
it('sets the correct page title', async () => {
59-
renderComponent();
60-
61-
await waitFor(() => {
62-
expect(document.title).toEqual(messages.programDashboardPageTitle.defaultMessage);
63-
});
64-
});
65-
6652
it('renders header text and ExploreProgramsCTA', async () => {
6753
renderComponent();
6854
await waitFor(() => {
@@ -89,14 +75,14 @@ describe('ProgramsList', () => {
8975
// Check for the first card
9076
expect(ProgramListCard).toHaveBeenCalledWith(
9177
expect.objectContaining({
92-
program: mockExtractedData[0],
78+
program: mockApiData[0],
9379
}),
9480
{},
9581
);
9682
// Check for the second card
9783
expect(ProgramListCard).toHaveBeenCalledWith(
9884
expect.objectContaining({
99-
program: mockExtractedData[1],
85+
program: mockApiData[1],
10086
}),
10187
{},
10288
);

0 commit comments

Comments
 (0)