feat: update the flag SUBSCRIPTIONS_ORDERS_MENU_ITEM_ENABLED
This commit is contained in:
1
.env
1
.env
@@ -40,4 +40,3 @@ ACCOUNT_SETTINGS_URL=''
|
||||
ACCOUNT_PROFILE_URL=''
|
||||
ENABLE_NOTICES=''
|
||||
CAREER_LINK_URL=''
|
||||
ENABLE_B2C_SUBSCRIPTIONS=false
|
||||
|
||||
@@ -47,4 +47,3 @@ ACCOUNT_SETTINGS_URL='http://localhost:1997'
|
||||
ACCOUNT_PROFILE_URL='http://localhost:1995'
|
||||
ENABLE_NOTICES=''
|
||||
CAREER_LINK_URL=''
|
||||
ENABLE_B2C_SUBSCRIPTIONS=false
|
||||
|
||||
@@ -46,4 +46,3 @@ ACCOUNT_SETTINGS_URL='http://account-settings-url.test'
|
||||
ACCOUNT_PROFILE_URL='http://account-profile-url.test'
|
||||
ENABLE_NOTICES=''
|
||||
CAREER_LINK_URL=''
|
||||
ENABLE_B2C_SUBSCRIPTIONS=false
|
||||
|
||||
@@ -16,7 +16,6 @@ const configuration = {
|
||||
SUPPORT_URL: process.env.SUPPORT_URL || null,
|
||||
ENABLE_NOTICES: process.env.ENABLE_NOTICES || null,
|
||||
CAREER_LINK_URL: process.env.CAREER_LINK_URL || null,
|
||||
ENABLE_B2C_SUBSCRIPTIONS: process.env.ENABLE_B2C_SUBSCRIPTIONS || null,
|
||||
};
|
||||
|
||||
const features = {};
|
||||
|
||||
@@ -54,6 +54,13 @@ exports[`CollapseMenuBody render 1`] = `
|
||||
>
|
||||
Account
|
||||
</Button>
|
||||
<Button
|
||||
as="a"
|
||||
href="http://localhost:1996/orders"
|
||||
variant="inverse-primary"
|
||||
>
|
||||
Order History
|
||||
</Button>
|
||||
<Button
|
||||
as="a"
|
||||
href="http://localhost:18000/logout"
|
||||
|
||||
@@ -46,6 +46,7 @@ const config = {
|
||||
SUPPORT_URL: 'http://localhost:18000/support',
|
||||
CAREER_LINK_URL: 'http://localhost:18000/career',
|
||||
LMS_BASE_URL: 'http:/localhost:18000',
|
||||
SUBSCRIPTIONS_ORDERS_MENU_ITEM_ENABLED: 'false',
|
||||
};
|
||||
getConfig.mockReturnValue(config);
|
||||
|
||||
|
||||
@@ -8,6 +8,6 @@ export const isEnterpriseUser = () => {
|
||||
return userRoleNames.includes('enterprise_learner');
|
||||
};
|
||||
|
||||
export const showOrdersAndSubscriptionsMenuItem = () => (getConfig().ENABLE_B2C_SUBSCRIPTIONS?.toLowerCase() === 'true' && !isEnterpriseUser());
|
||||
export const showOrdersAndSubscriptionsMenuItem = () => (getConfig().SUBSCRIPTIONS_ORDERS_MENU_ITEM_ENABLED?.toLowerCase() === 'true' && !isEnterpriseUser());
|
||||
|
||||
export default isEnterpriseUser;
|
||||
|
||||
@@ -44,17 +44,17 @@ describe('showOrdersAndSubscriptionsMenuItem', () => {
|
||||
getAuthenticatedUser.mockReset();
|
||||
});
|
||||
|
||||
test('should return true when ENABLE_B2C_SUBSCRIPTIONS is true and isEnterpriseUser returns false', () => {
|
||||
test('should return true when SUBSCRIPTIONS_ORDERS_MENU_ITEM_ENABLED is true and isEnterpriseUser returns false', () => {
|
||||
getConfig.mockReturnValueOnce({
|
||||
ENABLE_B2C_SUBSCRIPTIONS: 'true',
|
||||
SUBSCRIPTIONS_ORDERS_MENU_ITEM_ENABLED: 'true',
|
||||
});
|
||||
getAuthenticatedUser.mockReturnValueOnce({ roles: [] });
|
||||
expect(showOrdersAndSubscriptionsMenuItem()).toBe(true);
|
||||
});
|
||||
|
||||
test('should return false when ENABLE_B2C_SUBSCRIPTIONS is false and isEnterpriseUser returns false', () => {
|
||||
test('should return false when SUBSCRIPTIONS_ORDERS_MENU_ITEM_ENABLED is false and isEnterpriseUser returns false', () => {
|
||||
getConfig.mockReturnValueOnce({
|
||||
ENABLE_B2C_SUBSCRIPTIONS: 'false',
|
||||
SUBSCRIPTIONS_ORDERS_MENU_ITEM_ENABLED: 'false',
|
||||
});
|
||||
getAuthenticatedUser.mockReturnValueOnce({ roles: ['role1', 'role2', 'role3'] });
|
||||
expect(showOrdersAndSubscriptionsMenuItem()).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user