From 5ddb9bf17320cbd5949724090c34de90a4f01404 Mon Sep 17 00:00:00 2001 From: Navin Karkera Date: Mon, 27 Nov 2023 16:18:26 +0530 Subject: [PATCH] test: use test id for detecting component --- src/course-outline/CourseOutline.scss | 1 - src/course-outline/CourseOutline.test.jsx | 11 ++++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/course-outline/CourseOutline.scss b/src/course-outline/CourseOutline.scss index 516e4b7d39..732420365c 100644 --- a/src/course-outline/CourseOutline.scss +++ b/src/course-outline/CourseOutline.scss @@ -1,3 +1,2 @@ @import "./header-navigations/HeaderNavigations"; -@import "./outline-sidebar/OulineSidebar"; @import "./status-bar/StatusBar"; diff --git a/src/course-outline/CourseOutline.test.jsx b/src/course-outline/CourseOutline.test.jsx index 4087cfeee7..b6d98bc470 100644 --- a/src/course-outline/CourseOutline.test.jsx +++ b/src/course-outline/CourseOutline.test.jsx @@ -1,7 +1,5 @@ import React from 'react'; -import { - render, waitFor, cleanup, -} from '@testing-library/react'; +import { render, waitFor } from '@testing-library/react'; import { IntlProvider } from '@edx/frontend-platform/i18n'; import { AppProvider } from '@edx/frontend-platform/react'; import { initializeMockApp } from '@edx/frontend-platform'; @@ -127,9 +125,8 @@ describe('', () => { expect(getByText('4/9 completed')).toBeInTheDocument(); }); - it('check enable highlights when enable highlights query is successfully', async () => { - cleanup(); - const { getByText } = render(); + it('check highlights are enabled after enable highlights query is successful', async () => { + const { findByTestId } = render(); axiosMock .onGet(getCourseOutlineIndexApiUrl(courseId)) @@ -148,6 +145,6 @@ describe('', () => { .reply(200); await executeThunk(enableCourseHighlightsEmailsQuery(courseId), store.dispatch); - expect(getByText('Enabled')).toBeInTheDocument(); + expect(await findByTestId('highlights-enabled-span')).toBeInTheDocument(); }); });