feat: add NON_BROWSABLE_COURSES to MFE config (#620)

This commit is contained in:
diana-villalvazo-wgu
2025-05-21 11:21:31 -06:00
committed by GitHub
parent 66fdd79bdf
commit dcab4f1b75
6 changed files with 12 additions and 2 deletions

1
.env
View File

@@ -41,3 +41,4 @@ ENABLE_NOTICES=''
CAREER_LINK_URL=''
ENABLE_EDX_PERSONAL_DASHBOARD=false
ENABLE_PROGRAMS=false
NON_BROWSABLE_COURSES=false

View File

@@ -47,3 +47,4 @@ ENABLE_NOTICES=''
CAREER_LINK_URL=''
ENABLE_EDX_PERSONAL_DASHBOARD=false
ENABLE_PROGRAMS=false
NON_BROWSABLE_COURSES=false

View File

@@ -46,3 +46,4 @@ ENABLE_NOTICES=''
CAREER_LINK_URL=''
ENABLE_EDX_PERSONAL_DASHBOARD=true
ENABLE_PROGRAMS=false
NON_BROWSABLE_COURSES=false

View File

@@ -19,6 +19,7 @@ const configuration = {
ENABLE_EDX_PERSONAL_DASHBOARD: process.env.ENABLE_EDX_PERSONAL_DASHBOARD === 'true',
SEARCH_CATALOG_URL: process.env.SEARCH_CATALOG_URL || null,
ENABLE_PROGRAMS: process.env.ENABLE_PROGRAMS === 'true',
NON_BROWSABLE_COURSES: process.env.NON_BROWSABLE_COURSES === 'true',
};
const features = {};

View File

@@ -22,14 +22,15 @@ const getLearnerHeaderMenu = (
href: `${urls.programsUrl()}`,
content: formatMessage(messages.program),
}] : []),
{
...(!getConfig().NON_BROWSABLE_COURSES ? [{
type: 'item',
href: `${urls.baseAppUrl(courseSearchUrl)}`,
content: formatMessage(messages.discoverNew),
onClick: (e) => {
exploreCoursesClick(e);
},
},
}]
: []),
],
secondaryMenu: [
...(getConfig().SUPPORT_URL ? [{

View File

@@ -44,4 +44,9 @@ describe('LearnerDashboardHeader', () => {
const wrapper = shallow(<LearnerDashboardHeader />);
expect(wrapper.instance.findByType(Header)[0].props.mainMenuItems.length).toBe(3);
});
test('should not display Discover New tab if it is disabled by configuration', () => {
mergeConfig({ NON_BROWSABLE_COURSES: true });
const wrapper = shallow(<LearnerDashboardHeader />);
expect(wrapper.instance.findByType(Header)[0].props.mainMenuItems.length).toBe(2);
});
});