diff --git a/src/course-home/courseware-search/CoursewareResultsFilter.test.jsx b/src/course-home/courseware-search/CoursewareResultsFilter.test.jsx
index 997728b5ef..785167003c 100644
--- a/src/course-home/courseware-search/CoursewareResultsFilter.test.jsx
+++ b/src/course-home/courseware-search/CoursewareResultsFilter.test.jsx
@@ -68,29 +68,38 @@ describe('CoursewareSearchResultsFilter', () => {
it('should render without errors', async () => {
await waitFor(() => {
- expect(screen.queryByTestId('courseware-search-results-tabs')).toBeInTheDocument();
- expect(screen.queryByTestId('courseware-search-results-tabs-all')).toBeInTheDocument();
- expect(screen.queryByTestId('courseware-search-results-tabs-text')).toBeInTheDocument();
- expect(screen.queryByTestId('courseware-search-results-tabs-video')).toBeInTheDocument();
- expect(screen.queryByTestId('courseware-search-results-tabs-sequence')).toBeInTheDocument();
- expect(screen.queryByTestId('courseware-search-results-tabs-other')).toBeInTheDocument();
+ expect(useCoursewareSearchParams).toBeCalled();
});
+
+ expect(screen.queryByTestId('courseware-search-results-tabs')).toBeInTheDocument();
+ expect(screen.queryByTestId('courseware-search-results-tabs-all')).toBeInTheDocument();
+ expect(screen.queryByTestId('courseware-search-results-tabs-text')).toBeInTheDocument();
+ expect(screen.queryByTestId('courseware-search-results-tabs-video')).toBeInTheDocument();
+ expect(screen.queryByTestId('courseware-search-results-tabs-sequence')).toBeInTheDocument();
+ expect(screen.queryByTestId('courseware-search-results-tabs-other')).toBeInTheDocument();
});
});
describe('when returning only one result type', () => {
beforeEach(async () => {
- // Filter only videos
- const results = searchResultsFactory().filter(({ type }) => type === 'video');
+ // Get results for only videos
+ const data = searchResultsFactory();
+ const onlyVideos = data.results.filter(({ type }) => type === 'video');
+ const filteredResults = {
+ ...data,
+ results: onlyVideos,
+ };
- useModel.mockReturnValue(results);
+ useModel.mockReturnValue(filteredResults);
await renderComponent();
});
- it('should render without errors', async () => {
+ it('should not render', async () => {
await waitFor(() => {
- expect(screen.queryByTestId('courseware-search-results-tabs')).not.toBeInTheDocument();
+ expect(useCoursewareSearchParams).toBeCalled();
});
+
+ expect(screen.queryByTestId('courseware-search-results-tabs')).not.toBeInTheDocument();
});
});
@@ -108,8 +117,10 @@ describe('CoursewareSearchResultsFilter', () => {
it('should not render', async () => {
await waitFor(() => {
- expect(screen.queryByTestId('courseware-search-results-tabs')).not.toBeInTheDocument();
+ expect(useCoursewareSearchParams).toBeCalled();
});
+
+ expect(screen.queryByTestId('courseware-search-results-tabs')).not.toBeInTheDocument();
});
});
});
diff --git a/src/course-home/courseware-search/__snapshots__/CoursewareSearchResults.test.jsx.snap b/src/course-home/courseware-search/__snapshots__/CoursewareSearchResults.test.jsx.snap
index c38958db29..12178a62ed 100644
--- a/src/course-home/courseware-search/__snapshots__/CoursewareSearchResults.test.jsx.snap
+++ b/src/course-home/courseware-search/__snapshots__/CoursewareSearchResults.test.jsx.snap
@@ -26,7 +26,7 @@ exports[`CoursewareSearchResults when list of results is provided should match t
xmlns="http://www.w3.org/2000/svg"
>
@@ -140,7 +140,7 @@ exports[`CoursewareSearchResults when list of results is provided should match t
xmlns="http://www.w3.org/2000/svg"
>