File tree Expand file tree Collapse file tree 5 files changed +10
-9
lines changed Expand file tree Collapse file tree 5 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ const configuration = {
1919 LOGO_URL : process . env . LOGO_URL ,
2020 ENABLE_EDX_PERSONAL_DASHBOARD : process . env . ENABLE_EDX_PERSONAL_DASHBOARD === 'true' ,
2121 SEARCH_CATALOG_URL : process . env . SEARCH_CATALOG_URL || null ,
22+ ENABLE_PROGRAMS : ! ! process . env . ENABLE_PROGRAMS ,
2223} ;
2324
2425const features = { } ;
Original file line number Diff line number Diff line change @@ -17,11 +17,11 @@ const getLearnerHeaderMenu = (
1717 content : formatMessage ( messages . course ) ,
1818 isActive : true ,
1919 } ,
20- {
20+ ... ( getConfig ( ) . ENABLE_PROGRAMS ? [ {
2121 type : 'item' ,
2222 href : `${ urls . programsUrl ( ) } ` ,
2323 content : formatMessage ( messages . program ) ,
24- } ,
24+ } ] : [ ] ) ,
2525 {
2626 type : 'item' ,
2727 href : `${ urls . baseAppUrl ( courseSearchUrl ) } ` ,
Original file line number Diff line number Diff line change @@ -12,11 +12,6 @@ exports[`LearnerDashboardHeader render 1`] = `
1212 " isActive" : true ,
1313 " type" : " item" ,
1414 },
15- {
16- " content" : " Programs" ,
17- " href" : " http://localhost:18000/dashboard/programs" ,
18- " type" : " item" ,
19- },
2015 {
2116 " content" : " Discover New" ,
2217 " href" : " http://localhost:18000/course-search-url" ,
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ describe('LearnerDashboardHeader hooks', () => {
5656 username : 'test' ,
5757 } ;
5858 const learnerHomeHeaderMenu = useLearnerDashboardHeaderMenu ( { courseSearchUrl, authenticatedUser } ) ;
59- expect ( learnerHomeHeaderMenu . mainMenu . length ) . toBe ( 3 ) ;
59+ expect ( learnerHomeHeaderMenu . mainMenu . length ) . toBe ( 2 ) ;
6060 } ) ;
6161 } ) ;
6262
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ describe('LearnerDashboardHeader', () => {
2929 expect ( wrapper . instance . findByType ( 'ConfirmEmailBanner' ) ) . toHaveLength ( 1 ) ;
3030 expect ( wrapper . instance . findByType ( 'MasqueradeBar' ) ) . toHaveLength ( 1 ) ;
3131 expect ( wrapper . instance . findByType ( Header ) ) . toHaveLength ( 1 ) ;
32- wrapper . instance . findByType ( Header ) [ 0 ] . props . mainMenuItems [ 2 ] . onClick ( ) ;
32+ wrapper . instance . findByType ( Header ) [ 0 ] . props . mainMenuItems [ 1 ] . onClick ( ) ;
3333 expect ( findCoursesNavClicked ) . toHaveBeenCalledWith ( urls . baseAppUrl ( '/course-search-url' ) ) ;
3434 expect ( wrapper . instance . findByType ( Header ) [ 0 ] . props . secondaryMenuItems . length ) . toBe ( 0 ) ;
3535 } ) ;
@@ -39,4 +39,9 @@ describe('LearnerDashboardHeader', () => {
3939 const wrapper = shallow ( < LearnerDashboardHeader /> ) ;
4040 expect ( wrapper . instance . findByType ( Header ) [ 0 ] . props . secondaryMenuItems . length ) . toBe ( 1 ) ;
4141 } ) ;
42+ test ( 'should display Programs link if the service is configured in the backend' , ( ) => {
43+ mergeConfig ( { ENABLE_PROGRAMS : true } ) ;
44+ const wrapper = shallow ( < LearnerDashboardHeader /> ) ;
45+ expect ( wrapper . instance . findByType ( Header ) [ 0 ] . props . mainMenuItems . length ) . toBe ( 3 ) ;
46+ } ) ;
4247} ) ;
You can’t perform that action at this time.
0 commit comments