Skip to content

Commit 7a76aef

Browse files
chore(tests): restore coverage
1 parent cf8e505 commit 7a76aef

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

src/discussions/discussions-home/DiscussionsHome.test.jsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ describe('DiscussionsHome', () => {
9090

9191
test('full view should hide close button', async () => {
9292
renderComponent(`/${courseId}/topics`);
93-
expect(screen.queryByText(navigationBarMessages.allTopics.defaultMessage))
94-
.toBeInTheDocument();
93+
await screen.findByText(navigationBarMessages.allTopics.defaultMessage);
9594
expect(screen.queryByRole('button', { name: 'Close' }))
9695
.not
9796
.toBeInTheDocument();
@@ -206,9 +205,7 @@ describe('DiscussionsHome', () => {
206205
await executeThunk(fetchCourseConfig(courseId), store.dispatch, store.getState);
207206
await renderComponent(`/${courseId}/learners`);
208207

209-
waitFor(() => {
210-
expect(screen.queryByText('Nothing here yet')).toBeInTheDocument();
211-
});
208+
await screen.findByText('Nothing here yet');
212209
});
213210

214211
it('should display post editor form when click on add a post button for posts', async () => {
@@ -263,7 +260,7 @@ describe('DiscussionsHome', () => {
263260
it('should display navigation tabs', async () => {
264261
renderComponent(`/${courseId}/topics`);
265262

266-
await waitFor(() => expect(screen.queryByText('Discussion')).toBeInTheDocument());
263+
await screen.findByText('Discussion');
267264
});
268265

269266
it('should display content unavailable message when the user is not enrolled in the course.', async () => {
@@ -272,7 +269,7 @@ describe('DiscussionsHome', () => {
272269

273270
renderComponent();
274271

275-
await waitFor(() => expect(screen.queryByText('Content unavailable')).toBeInTheDocument());
272+
await screen.findByText('Content unavailable');
276273
});
277274

278275
it('should redirect to dashboard when the user clicks on the Enroll button.', async () => {

src/discussions/empty-posts/EmptyTopics.test.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,13 @@ describe('EmptyTopics', () => {
6666

6767
test('"no topic selected" text shown when viewing topics page', async () => {
6868
renderComponent(`/${courseId}/topics/`);
69-
expect(screen.queryByText(messages.emptyTitle.defaultMessage))
70-
.toBeInTheDocument();
69+
await screen.findByText(messages.emptyTitle.defaultMessage);
7170
});
7271

7372
test('"no post selected" text shown when viewing a specific topic', async () => {
7473
await setupMockResponse();
7574
renderComponent(`/${courseId}/topics/ncwtopic-3/`);
7675

77-
expect(screen.queryByText(messages.noPostSelected.defaultMessage))
78-
.toBeInTheDocument();
76+
await screen.findByText(messages.noPostSelected.defaultMessage);
7977
});
8078
});

src/discussions/in-context-topics/TopicPostsView.test.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ describe('InContext Topic Posts View', () => {
283283
await setupTopicsMockResponse(0, 0, 0);
284284
await renderComponent({ topicId: 'test-topic', category: 'test-category' });
285285

286-
await waitFor(() => expect(within(container).queryByText('Nothing here yet')).toBeInTheDocument());
287-
expect(within(container).queryByText('No topic exists')).toBeInTheDocument();
288-
expect(within(container).queryByText('Unnamed Topic')).toBeInTheDocument();
286+
await within(container).findByText('Nothing here yet');
287+
await within(container).findByText('No topic exists');
288+
await within(container).findByText('Unnamed Topic');
289289
},
290290
);
291291

0 commit comments

Comments
 (0)