From d48d6ffa5d80c79d855eb5f8b98cf1b5d9929729 Mon Sep 17 00:00:00 2001 From: Kristin Aoki <42981026+KristinAoki@users.noreply.github.com> Date: Wed, 22 Nov 2023 13:42:37 -0500 Subject: [PATCH] feat: add new libray button (#710) --- src/studio-home/StudioHome.jsx | 31 +++++++++++++---------------- src/studio-home/StudioHome.test.jsx | 9 +++++---- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/studio-home/StudioHome.jsx b/src/studio-home/StudioHome.jsx index 3222a0e17..8b670c4ab 100644 --- a/src/studio-home/StudioHome.jsx +++ b/src/studio-home/StudioHome.jsx @@ -42,7 +42,6 @@ const StudioHome = ({ intl }) => { studioRequestEmail, libraryAuthoringMfeUrl, redirectToLibraryAuthoringMfe, - splitStudioHome, } = studioHomeData; function getHeaderButtons() { @@ -68,26 +67,24 @@ const StudioHome = ({ intl }) => { ); } - let libraryHref = `${getConfig().STUDIO_BASE_URL}/home#libraries-tab`; - if (splitStudioHome) { - libraryHref = `${getConfig().STUDIO_BASE_URL}/home_library`; - } + let libraryHref = `${getConfig().STUDIO_BASE_URL}/home_library`; if (redirectToLibraryAuthoringMfe) { libraryHref = `${libraryAuthoringMfeUrl}/create`; - headerButtons.push( - , - ); } + headerButtons.push( + , + ); + return headerButtons; } diff --git a/src/studio-home/StudioHome.test.jsx b/src/studio-home/StudioHome.test.jsx index c2fd189e7..a926d7c9e 100644 --- a/src/studio-home/StudioHome.test.jsx +++ b/src/studio-home/StudioHome.test.jsx @@ -116,15 +116,16 @@ describe('', async () => { }); describe('render new library button', () => { - it('should not show button', async () => { + it('href should include home_library', async () => { useSelector.mockReturnValue({ ...studioHomeMock, courseCreatorStatus: COURSE_CREATOR_STATES.granted, }); + const studioBaseUrl = 'http://localhost:18010'; - const { queryByTestId } = render(); - const createNewLibraryButton = queryByTestId('new-library-button'); - expect(createNewLibraryButton).toBeNull(); + const { getByTestId } = render(); + const createNewLibraryButton = getByTestId('new-library-button'); + expect(createNewLibraryButton.getAttribute('href')).toBe(`${studioBaseUrl}/home_library`); }); it('href should include create', async () => { useSelector.mockReturnValue({