Skip to content

Commit

Permalink
test: use test id for detecting component
Browse files Browse the repository at this point in the history
  • Loading branch information
navinkarkera committed Dec 5, 2023
1 parent e92b84e commit 5ddb9bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/course-outline/CourseOutline.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@import "./header-navigations/HeaderNavigations";
@import "./outline-sidebar/OulineSidebar";
@import "./status-bar/StatusBar";
11 changes: 4 additions & 7 deletions src/course-outline/CourseOutline.test.jsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -127,9 +125,8 @@ describe('<CourseOutline />', () => {
expect(getByText('4/9 completed')).toBeInTheDocument();
});

it('check enable highlights when enable highlights query is successfully', async () => {
cleanup();
const { getByText } = render(<RootWrapper />);
it('check highlights are enabled after enable highlights query is successful', async () => {
const { findByTestId } = render(<RootWrapper />);

axiosMock
.onGet(getCourseOutlineIndexApiUrl(courseId))
Expand All @@ -148,6 +145,6 @@ describe('<CourseOutline />', () => {
.reply(200);

await executeThunk(enableCourseHighlightsEmailsQuery(courseId), store.dispatch);
expect(getByText('Enabled')).toBeInTheDocument();
expect(await findByTestId('highlights-enabled-span')).toBeInTheDocument();
});
});

0 comments on commit 5ddb9bf

Please sign in to comment.