Skip to content

Commit 17defd1

Browse files
committed
test: fix tests
1 parent a684b4c commit 17defd1

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/library-authoring/import-course/stepper/ImportStepperPage.test.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
initializeMocks,
44
render,
55
screen,
6-
fireEvent,
76
waitFor,
87
} from '@src/testUtils';
98
import { initialState } from '@src/studio-home/factories/mockApiResponses';
@@ -125,10 +124,9 @@ describe('<ImportStepperModal />', () => {
125124
/managing risk in the information age is being analyzed for review prior to import/i,
126125
)).toBeInTheDocument());
127126

128-
expect(screen.getByText('Analysis Summary')).toBeInTheDocument();
129-
expect(screen.getByText('Analysis Details')).toBeInTheDocument();
127+
expect(await screen.findByText('Analysis Summary')).toBeInTheDocument();
130128
// The import details is loading
131-
expect(screen.getByText('The selected course is being analyzed for import and review')).toBeInTheDocument();
129+
expect(await screen.findByText('Import Analysis in Progress')).toBeInTheDocument();
132130
});
133131

134132
it('the course should remain selected on back', async () => {
@@ -140,14 +138,14 @@ describe('<ImportStepperModal />', () => {
140138

141139
// Select a course
142140
const courseCard = screen.getAllByRole('radio')[0];
143-
await fireEvent.click(courseCard);
141+
await user.click(courseCard);
144142
expect(courseCard).toBeChecked();
145143

146144
// Click next
147145
expect(nextButton).toBeEnabled();
148146
await user.click(nextButton);
149147

150-
const backButton = await screen.getByRole('button', { name: /back/i });
148+
const backButton = await screen.findByRole('button', { name: /back/i });
151149
await user.click(backButton);
152150

153151
expect(screen.getByText(/managing risk in the information age/i)).toBeInTheDocument();

src/library-authoring/import-course/stepper/ReviewImportDetails.test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { mockContentLibrary } from '@src/library-authoring/data/api.mocks';
77
import { ReviewImportDetails } from './ReviewImportDetails';
88
import messages from '../messages';
99

10+
mockContentLibrary.applyMock();
11+
const { libraryId } = mockContentLibrary;
12+
1013
// Mock the useCourseDetails hook
1114
jest.mock('@src/course-outline/data/apiHooks', () => ({
1215
useCourseDetails: jest.fn().mockReturnValue({ isPending: true, data: null }),
@@ -15,14 +18,14 @@ jest.mock('@src/course-outline/data/apiHooks', () => ({
1518
// Mock the useMigrationInfo hook
1619
jest.mock('@src/library-authoring/data/apiHooks', () => ({
1720
useMigrationInfo: jest.fn().mockReturnValue({ isPending: true, data: null }),
21+
useContentLibrary: jest.fn().mockReturnValue({}),
1822
}));
1923

2024
// Mock the useGetBlockTypes hook
2125
jest.mock('@src/search-manager', () => ({
2226
useGetBlockTypes: jest.fn().mockReturnValue({ isPending: true, data: null }),
2327
}));
2428

25-
const { libraryId } = mockContentLibrary;
2629
const render = (element: React.ReactElement) => {
2730
const params: { libraryId: string } = { libraryId };
2831
return baseRender(element, {

0 commit comments

Comments
 (0)