Skip to content

Commit 0c644b0

Browse files
chore: fix tests
1 parent 4932a9b commit 0c644b0

5 files changed

Lines changed: 22 additions & 16 deletions

File tree

package-lock.json

Lines changed: 8 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
"@edx/browserslist-config": "1.5.0",
3838
"@edx/frontend-component-footer": "^14.3.0",
3939
"@edx/frontend-component-header": "^6.2.0",
40-
"@edx/frontend-lib-learning-assistant": "github:brian-smith-tcril/frontend-lib-learning-assistant#27706ed",
41-
"@edx/frontend-lib-special-exams": "github:brian-smith-tcril/frontend-lib-special-exams#a65f470",
40+
"@edx/frontend-lib-learning-assistant": "^2.20.0",
41+
"@edx/frontend-lib-special-exams": "^3.5.0",
4242
"@edx/frontend-platform": "^8.3.1",
4343
"@edx/openedx-atlas": "^0.6.0",
4444
"@edx/react-unit-test-utils": "3.0.0",

src/courseware/CoursewareContainer.test.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ describe('CoursewareContainer', () => {
221221
});
222222

223223
history.push(`/course/${courseId}`);
224-
const container = await waitFor(() => loadContainer());
224+
const container = await loadContainer();
225225

226226
assertLoadedHeader(container);
227227
assertSequenceNavigation(container);
@@ -244,7 +244,7 @@ describe('CoursewareContainer', () => {
244244
axiosMock.onGet(`${getConfig().LMS_BASE_URL}/api/courseware/resume/${courseId}`).reply(200, {});
245245

246246
history.push(`/course/${courseId}`);
247-
const container = await waitFor(() => loadContainer());
247+
const container = await loadContainer();
248248

249249
assertLoadedHeader(container);
250250
assertSequenceNavigation(container);
@@ -294,7 +294,7 @@ describe('CoursewareContainer', () => {
294294
describe('when the URL does not contain a unit ID', () => {
295295
it('should choose a unit within the section\'s first sequence', async () => {
296296
setUrl(sectionTree[1].id);
297-
const container = await waitFor(() => loadContainer());
297+
const container = await loadContainer();
298298
assertLoadedHeader(container);
299299
assertSequenceNavigation(container, 2);
300300
assertLocation(container, sequenceTree[1][0].id, unitTree[1][0][0].id);
@@ -369,7 +369,7 @@ describe('CoursewareContainer', () => {
369369

370370
it('should pick the first unit if position was not defined (activeUnitIndex becomes 0)', async () => {
371371
history.push(`/course/${courseId}/${sequenceBlock.id}`);
372-
const container = await waitFor(() => loadContainer());
372+
const container = await loadContainer();
373373

374374
assertLoadedHeader(container);
375375
assertSequenceNavigation(container);
@@ -388,7 +388,7 @@ describe('CoursewareContainer', () => {
388388
setUpMockRequests({ sequenceMetadatas: [sequenceMetadata] });
389389

390390
history.push(`/course/${courseId}/${sequenceBlock.id}`);
391-
const container = await waitFor(() => loadContainer());
391+
const container = await loadContainer();
392392

393393
assertLoadedHeader(container);
394394
assertSequenceNavigation(container);
@@ -405,7 +405,7 @@ describe('CoursewareContainer', () => {
405405

406406
it('should load the specified unit', async () => {
407407
history.push(`/course/${courseId}/${sequenceBlock.id}/${unitBlocks[2].id}`);
408-
const container = await waitFor(() => loadContainer());
408+
const container = await loadContainer();
409409

410410
assertLoadedHeader(container);
411411
assertSequenceNavigation(container);
@@ -421,7 +421,7 @@ describe('CoursewareContainer', () => {
421421
});
422422

423423
history.push(`/course/${courseId}/${sequenceBlock.id}/${unitBlocks[0].id}`);
424-
const container = await waitFor(() => loadContainer());
424+
const container = await loadContainer();
425425

426426
const sequenceNavButtons = container.querySelectorAll('nav.sequence-navigation a, nav.sequence-navigation button');
427427
const sequenceNextButton = sequenceNavButtons[4];

src/courseware/course/sequence/Sequence.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ describe('Sequence', () => {
154154
testStore.dispatch(fetchSequenceFailure({ sequenceId: mockData.sequenceId }));
155155
render(<Sequence {...mockData} />, { store: testStore, wrapWithRouter: true });
156156

157-
expect(screen.getByText('There was an error loading this course.')).toBeInTheDocument();
157+
await screen.findByText('There was an error loading this course.');
158158
});
159159

160160
it('handles loading unit', async () => {

src/courseware/course/sequence/sequence-navigation/SequenceNavigationTabs.test.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ describe('Sequence Navigation Tabs', () => {
5151
await act(async () => {
5252
useIndexOfLastVisibleChild.mockReturnValue([-1, null, null]);
5353
const booyah = render(<SequenceNavigationTabs {...mockData} />, { wrapWithRouter: true });
54+
55+
// wait for links to appear so we aren't testing an empty div
56+
await screen.findAllByRole('link');
57+
5458
container = booyah.container;
5559

5660
const dropdownToggle = container.querySelector('.dropdown-toggle');

0 commit comments

Comments
 (0)