diff --git a/src/course-outline/CourseOutline.test.jsx b/src/course-outline/CourseOutline.test.jsx index 39e8cc3871..b7f8332eeb 100644 --- a/src/course-outline/CourseOutline.test.jsx +++ b/src/course-outline/CourseOutline.test.jsx @@ -226,7 +226,7 @@ describe('<CourseOutline />', () => { }); it('check video sharing option shows error on failure', async () => { - const { findByLabelText, queryAllByRole } = render(<RootWrapper />); + render(<RootWrapper />); axiosMock .onPost(getCourseBlockApiUrl(courseId), { @@ -235,7 +235,7 @@ describe('<CourseOutline />', () => { }, }) .reply(500); - const optionDropdown = await findByLabelText(statusBarMessages.videoSharingTitle.defaultMessage); + const optionDropdown = await screen.findByLabelText(statusBarMessages.videoSharingTitle.defaultMessage); await act( async () => fireEvent.change(optionDropdown, { target: { value: VIDEO_SHARING_OPTIONS.allOff } }), ); @@ -247,7 +247,7 @@ describe('<CourseOutline />', () => { }, })); - const alertElements = queryAllByRole('alert'); + const alertElements = screen.queryAllByRole('alert'); expect(alertElements.find( (el) => el.classList.contains('alert-content'), )).toHaveTextContent( @@ -513,10 +513,10 @@ describe('<CourseOutline />', () => { notificationDismissUrl: '/some/url', }); - const { findByRole, findByText } = render(<RootWrapper />); - const alert = await findByText(pageAlertMessages.configurationErrorTitle.defaultMessage); + render(<RootWrapper />); + const alert = await screen.findByText(pageAlertMessages.configurationErrorTitle.defaultMessage); expect(alert).toBeInTheDocument(); - const dismissBtn = await findByRole('button', { name: 'Dismiss' }); + const dismissBtn = await screen.findByRole('button', { name: 'Dismiss' }); axiosMock .onDelete('/some/url') .reply(204); @@ -2163,10 +2163,10 @@ describe('<CourseOutline />', () => { }); it('check whether unit copy & paste option works correctly', async () => { - const { findAllByTestId, queryByTestId, findAllByRole } = render(<RootWrapper />); + render(<RootWrapper />); // get first section -> first subsection -> first unit element const [section] = courseOutlineIndexMock.courseStructure.childInfo.children; - const [sectionElement] = await findAllByTestId('section-card'); + const [sectionElement] = await screen.findAllByTestId('section-card'); const [subsection] = section.childInfo.children; axiosMock .onGet(getXBlockApiUrl(section.id)) @@ -2205,7 +2205,7 @@ describe('<CourseOutline />', () => { await act(async () => fireEvent.mouseOver(clipboardLabel)); // find clipboard content popover link - const popoverContent = queryByTestId('popover-content'); + const popoverContent = screen.queryByTestId('popover-content'); expect(popoverContent.tagName).toBe('A'); expect(popoverContent).toHaveAttribute('href', `${getConfig().STUDIO_BASE_URL}${unit.studioUrl}`); @@ -2236,7 +2236,7 @@ describe('<CourseOutline />', () => { errorFiles: ['error.css'], }); - let alerts = await findAllByRole('alert'); + let alerts = await screen.findAllByRole('alert'); // Exclude processing notification toast alerts = alerts.filter((el) => !el.classList.contains('toast-container')); // 3 alerts should be present diff --git a/src/course-unit/CourseUnit.test.jsx b/src/course-unit/CourseUnit.test.jsx index 552ab3e55c..d6b00a385d 100644 --- a/src/course-unit/CourseUnit.test.jsx +++ b/src/course-unit/CourseUnit.test.jsx @@ -1,6 +1,6 @@ import MockAdapter from 'axios-mock-adapter'; import { - act, render, waitFor, fireEvent, within, + act, render, waitFor, fireEvent, within, screen, } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { IntlProvider } from '@edx/frontend-platform/i18n'; @@ -525,10 +525,10 @@ describe('<CourseUnit />', () => { }); it('should display a warning alert for unpublished course unit version', async () => { - const { getAllByRole } = render(<RootWrapper />); + render(<RootWrapper />); await waitFor(() => { - const unpublishedAlert = getAllByRole('alert').find( + const unpublishedAlert = screen.getAllByRole('alert').find( (el) => el.classList.contains('alert-content'), ); expect(unpublishedAlert).toHaveTextContent(messages.alertUnpublishedVersion.defaultMessage); @@ -537,7 +537,7 @@ describe('<CourseUnit />', () => { }); it('should not display an unpublished alert for a course unit with explicit staff lock and unpublished status', async () => { - const { queryAllByRole } = render(<RootWrapper />); + render(<RootWrapper />); axiosMock .onGet(getCourseUnitApiUrl(courseId)) @@ -549,7 +549,7 @@ describe('<CourseUnit />', () => { await executeThunk(fetchCourseUnitQuery(courseId), store.dispatch); await waitFor(() => { - const alert = queryAllByRole('alert').find( + const alert = screen.queryAllByRole('alert').find( (el) => el.classList.contains('alert-content'), ); expect(alert).toBeUndefined(); diff --git a/src/library-authoring/data/apiHooks.ts b/src/library-authoring/data/apiHooks.ts index 312a2fe525..2f754d41bb 100644 --- a/src/library-authoring/data/apiHooks.ts +++ b/src/library-authoring/data/apiHooks.ts @@ -305,8 +305,7 @@ export const useUpdateCollectionComponents = (libraryId?: string, collectionId?: } return undefined; }, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - onSettled: (_data, _error, _variables) => { + onSettled: () => { if (libraryId !== undefined && collectionId !== undefined) { queryClient.invalidateQueries({ predicate: (query) => libraryQueryPredicate(query, libraryId) }); } @@ -321,8 +320,7 @@ export const useDeleteCollection = (libraryId: string, collectionId: string) => const queryClient = useQueryClient(); return useMutation({ mutationFn: async () => deleteCollection(libraryId, collectionId), - // eslint-disable-next-line @typescript-eslint/no-unused-vars - onSettled: (_data, _error, _variables) => { + onSettled: () => { queryClient.invalidateQueries({ queryKey: libraryAuthoringQueryKeys.contentLibrary(libraryId) }); queryClient.invalidateQueries({ predicate: (query) => libraryQueryPredicate(query, libraryId) }); }, @@ -336,8 +334,7 @@ export const useRestoreCollection = (libraryId: string, collectionId: string) => const queryClient = useQueryClient(); return useMutation({ mutationFn: async () => restoreCollection(libraryId, collectionId), - // eslint-disable-next-line @typescript-eslint/no-unused-vars - onSettled: (_data, _error, _variables) => { + onSettled: () => { queryClient.invalidateQueries({ queryKey: libraryAuthoringQueryKeys.contentLibrary(libraryId) }); queryClient.invalidateQueries({ predicate: (query) => libraryQueryPredicate(query, libraryId) }); },