@@ -33,9 +33,6 @@ let store;
3333const courseApiLinkV2 = `${ getApiBaseUrl ( ) } /api/contentstore/v2/home/courses` ;
3434const libraryApiLink = `${ getStudioHomeApiUrl ( ) } /libraries` ;
3535
36- // The Libraries v2 tab title contains a badge, so we need to use regex to match its tab text.
37- const librariesBetaTabTitle = / L i b r a r i e s B e t a / ;
38-
3936const tabSectionComponent = ( overrideProps ) => (
4037 < TabsSection
4138 showNewCourseContainer = { false }
@@ -91,7 +88,7 @@ describe('<TabsSection />', () => {
9188
9289 expect ( screen . getByRole ( 'tab' , { name : tabMessages . coursesTabTitle . defaultMessage } ) ) . toBeInTheDocument ( ) ;
9390
94- expect ( screen . getByRole ( 'tab' , { name : librariesBetaTabTitle } ) ) . toBeInTheDocument ( ) ;
91+ expect ( screen . getByRole ( 'tab' , { name : tabMessages . librariesTabTitle . defaultMessage } ) ) . toBeInTheDocument ( ) ;
9592
9693 expect ( screen . getByRole ( 'tab' , { name : tabMessages . legacyLibrariesTabTitle . defaultMessage } ) ) . toBeInTheDocument ( ) ;
9794 } ) ;
@@ -120,7 +117,7 @@ describe('<TabsSection />', () => {
120117 await executeThunk ( fetchStudioHomeData ( ) , store . dispatch ) ;
121118
122119 expect ( screen . getByText ( tabMessages . librariesTabTitle . defaultMessage ) ) . toBeInTheDocument ( ) ;
123- const librariesTab = screen . getByRole ( 'tab' , { name : librariesBetaTabTitle } ) ;
120+ const librariesTab = screen . getByRole ( 'tab' , { name : tabMessages . librariesTabTitle . defaultMessage } ) ;
124121 expect ( librariesTab ) . toBeInTheDocument ( ) ;
125122 // Check Tab.eventKey
126123 expect ( librariesTab ) . toHaveAttribute ( 'data-rb-event-key' , 'libraries' ) ;
@@ -352,7 +349,7 @@ describe('<TabsSection />', () => {
352349 await axiosMock . onGet ( getStudioHomeApiUrl ( ) ) . reply ( 200 , generateGetStudioHomeDataApiResponse ( ) ) ;
353350 await executeThunk ( fetchStudioHomeData ( ) , store . dispatch ) ;
354351
355- const librariesTab = await screen . findByRole ( 'tab' , { name : librariesBetaTabTitle } ) ;
352+ const librariesTab = await screen . findByRole ( 'tab' , { name : tabMessages . librariesTabTitle . defaultMessage } ) ;
356353 fireEvent . click ( librariesTab ) ;
357354
358355 expect ( librariesTab ) . toHaveClass ( 'active' ) ;
@@ -377,9 +374,6 @@ describe('<TabsSection />', () => {
377374 const user = userEvent . setup ( ) ;
378375 await act ( async ( ) => executeThunk ( fetchStudioHomeData ( ) , store . dispatch ) ) ;
379376
380- // Libraries v2 tab should not be shown
381- expect ( screen . queryByRole ( 'tab' , { name : librariesBetaTabTitle } ) ) . toBeNull ( ) ;
382-
383377 const librariesTab = await screen . findByRole ( 'tab' , { name : tabMessages . librariesTabTitle . defaultMessage } ) ;
384378 await user . click ( librariesTab ) ;
385379
@@ -399,9 +393,6 @@ describe('<TabsSection />', () => {
399393 const user = userEvent . setup ( ) ;
400394 await act ( async ( ) => executeThunk ( fetchStudioHomeData ( ) , store . dispatch ) ) ;
401395
402- // Libraries v2 tab should not be shown
403- expect ( screen . queryByRole ( 'tab' , { name : librariesBetaTabTitle } ) ) . toBeNull ( ) ;
404-
405396 const librariesTab = await screen . findByRole ( 'tab' , { name : tabMessages . librariesTabTitle . defaultMessage } ) ;
406397 await user . click ( librariesTab ) ;
407398
@@ -430,7 +421,7 @@ describe('<TabsSection />', () => {
430421 render ( ) ;
431422 await executeThunk ( fetchStudioHomeData ( ) , store . dispatch ) ;
432423
433- const librariesTab = await screen . findByRole ( 'tab' , { name : librariesBetaTabTitle } ) ;
424+ const librariesTab = await screen . findByRole ( 'tab' , { name : tabMessages . librariesTabTitle . defaultMessage } ) ;
434425 await user . click ( librariesTab ) ;
435426
436427 expect ( librariesTab ) . toHaveClass ( 'active' ) ;
@@ -453,7 +444,7 @@ describe('<TabsSection />', () => {
453444 // Libraries v1 tab should not be shown
454445 expect ( screen . queryByText ( tabMessages . legacyLibrariesTabTitle . defaultMessage ) ) . toBeNull ( ) ;
455446
456- const librariesTab = await screen . findByRole ( 'tab' , { name : librariesBetaTabTitle } ) ;
447+ const librariesTab = await screen . findByRole ( 'tab' , { name : tabMessages . librariesTabTitle . defaultMessage } ) ;
457448 fireEvent . click ( librariesTab ) ;
458449
459450 expect ( librariesTab ) . toHaveClass ( 'active' ) ;
@@ -478,7 +469,7 @@ describe('<TabsSection />', () => {
478469 await axiosMock . onGet ( getStudioHomeApiUrl ( ) ) . reply ( 200 , generateGetStudioHomeDataApiResponse ( ) ) ;
479470 await executeThunk ( fetchStudioHomeData ( ) , store . dispatch ) ;
480471
481- const librariesTab = await screen . findByRole ( 'tab' , { name : librariesBetaTabTitle } ) ;
472+ const librariesTab = await screen . findByRole ( 'tab' , { name : tabMessages . librariesTabTitle . defaultMessage } ) ;
482473 fireEvent . click ( librariesTab ) ;
483474
484475 expect ( librariesTab ) . toHaveClass ( 'active' ) ;
@@ -522,7 +513,7 @@ describe('<TabsSection />', () => {
522513 const user = userEvent . setup ( ) ;
523514 await act ( async ( ) => executeThunk ( fetchStudioHomeData ( ) , store . dispatch ) ) ;
524515
525- const librariesTab = await screen . findByRole ( 'tab' , { name : librariesBetaTabTitle } ) ;
516+ const librariesTab = await screen . findByRole ( 'tab' , { name : tabMessages . librariesTabTitle . defaultMessage } ) ;
526517 await user . click ( librariesTab ) ;
527518
528519 expect ( librariesTab ) . toHaveClass ( 'active' ) ;
@@ -546,7 +537,7 @@ describe('<TabsSection />', () => {
546537 render ( ) ;
547538 await executeThunk ( fetchStudioHomeData ( ) , store . dispatch ) ;
548539
549- const librariesTab = await screen . findByRole ( 'tab' , { name : librariesBetaTabTitle } ) ;
540+ const librariesTab = await screen . findByRole ( 'tab' , { name : tabMessages . librariesTabTitle . defaultMessage } ) ;
550541 await user . click ( librariesTab ) ;
551542
552543 expect ( librariesTab ) . toHaveClass ( 'active' ) ;
0 commit comments