diff --git a/src/studio-home/tabs-section/TabsSection.test.jsx b/src/studio-home/tabs-section/TabsSection.test.jsx index 215c3ee288..9b7fcfb6a9 100644 --- a/src/studio-home/tabs-section/TabsSection.test.jsx +++ b/src/studio-home/tabs-section/TabsSection.test.jsx @@ -158,11 +158,23 @@ describe('', () => { }); describe('taxonomies tab', () => { - it('should redirect to taxonomies page', async () => { + it('should not show taxonomies tab on page if not enabled', async () => { render(); axiosMock.onGet(getStudioHomeApiUrl()).reply(200, generateGetStudioHomeDataApiResponse()); await executeThunk(fetchStudioHomeData(), store.dispatch); + expect(screen.getByText(tabMessages.coursesTabTitle.defaultMessage)).toBeInTheDocument(); + expect(screen.queryByText(tabMessages.taxonomiesTabTitle.defaultMessage)).toBeNull(); + }); + + it('should redirect to taxonomies page', async () => { + const data = generateGetStudioHomeDataApiResponse(); + data.taxonomiesEnabled = true; + + render(); + axiosMock.onGet(getStudioHomeApiUrl()).reply(200, data); + await executeThunk(fetchStudioHomeData(), store.dispatch); + const taxonomiesTab = screen.getByText(tabMessages.taxonomiesTabTitle.defaultMessage); fireEvent.click(taxonomiesTab); diff --git a/src/studio-home/tabs-section/index.jsx b/src/studio-home/tabs-section/index.jsx index 1e0cb3848c..e1b6b91f62 100644 --- a/src/studio-home/tabs-section/index.jsx +++ b/src/studio-home/tabs-section/index.jsx @@ -33,7 +33,7 @@ const TabsSection = ({ libraryAuthoringMfeUrl, redirectToLibraryAuthoringMfe, courses, librariesEnabled, libraries, archivedCourses, - numPages, coursesCount, + numPages, coursesCount, taxonomiesEnabled, } = useSelector(getStudioHomeData); const { courseLoadingStatus, @@ -103,13 +103,15 @@ const TabsSection = ({ ); } - tabs.push( - , - ); + if (taxonomiesEnabled) { + tabs.push( + , + ); + } return tabs; }, [archivedCourses, librariesEnabled, showNewCourseContainer, isLoadingCourses, isLoadingLibraries]);