Skip to content

Commit

Permalink
fix: PR requests
Browse files Browse the repository at this point in the history
  • Loading branch information
kiram15 committed Oct 16, 2024
1 parent 8b8bf32 commit a6d24c2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/components/ContentHighlights/ContentHighlights.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import ContentHighlightsContextProvider from './ContentHighlightsContext';
import ContentHighlightToast from './ContentHighlightToast';
import { EnterpriseAppContext } from '../EnterpriseApp/EnterpriseAppContextProvider';
import { withLocation } from '../../hoc';
import { GROUP_TYPE_BUDGET } from '../PeopleManagement/constants';

const ContentHighlights = ({ location, enterpriseGroupsV1 }) => {
const navigate = useNavigate();
Expand All @@ -31,7 +32,7 @@ const ContentHighlights = ({ location, enterpriseGroupsV1 }) => {
try {
const response = await LmsApiService.fetchEnterpriseGroups();
response.data.results.forEach((group) => {
if (group.group_type === 'budget') {
if (group.group_type === GROUP_TYPE_BUDGET) {
setHasBudgetGroup(true);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { IntlProvider } from '@edx/frontend-platform/i18n';
import ContentHighlights from '../ContentHighlights';
import { EnterpriseAppContext } from '../../EnterpriseApp/EnterpriseAppContextProvider';
import LmsApiService from '../../../data/services/LmsApiService';
import { GROUP_TYPE_BUDGET } from '../../PeopleManagement/constants';

jest.mock('../../../data/services/LmsApiService');

Expand Down Expand Up @@ -86,7 +87,7 @@ describe('<ContentHighlights>', () => {
});
it('Displays the alert if custom groups is enabled and user is staff', () => {
LmsApiService.fetchEnterpriseGroups.mockImplementation(() => Promise.resolve({
data: { results: [{ group_type: 'budget' }] },
data: { results: [{ group_type: GROUP_TYPE_BUDGET }] },
}));
renderWithRouter(<ContentHighlightsWrapper location={{ state: {} }} />);
});
Expand Down
6 changes: 4 additions & 2 deletions src/components/PeopleManagement/constants.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
const MAX_LENGTH_GROUP_NAME = 60;
export default MAX_LENGTH_GROUP_NAME;
export const MAX_LENGTH_GROUP_NAME = 60;

export const GROUP_TYPE_BUDGET = 'budget';
export const GROUP_TYPE_FLEX = 'flex';
3 changes: 2 additions & 1 deletion src/components/Sidebar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { useOnMount } from '../../hooks';
import { EnterpriseSubsidiesContext } from '../EnterpriseSubsidiesContext';
import { EnterpriseAppContext } from '../EnterpriseApp/EnterpriseAppContextProvider';
import LmsApiService from '../../data/services/LmsApiService';
import { GROUP_TYPE_BUDGET } from '../PeopleManagement/constants';

const Sidebar = ({
baseUrl,
Expand Down Expand Up @@ -89,7 +90,7 @@ const Sidebar = ({
// we only want to hide the feature if a customer has a group this does not
// apply to all contexts/include all users
response.data.results.forEach((group) => {
if (group.group_type === 'budget') {
if (group.group_type === GROUP_TYPE_BUDGET) {
setHasBudgetGroup(true);
}
});
Expand Down

0 comments on commit a6d24c2

Please sign in to comment.