Skip to content

Commit

Permalink
refactor: remove remnants after removing edu and business catalogs (#380
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jajjibhai008 authored Mar 18, 2024
1 parent 7d10985 commit bfb2f3b
Show file tree
Hide file tree
Showing 21 changed files with 25 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ REFRESH_ACCESS_TOKEN_ENDPOINT=null
SEGMENT_KEY=''
SITE_NAME=null
USER_INFO_COOKIE_NAME=null
EDX_FOR_BUSINESS_TITLE=''
EDX_FOR_SUBSCRIPTION_TITLE=''
EDX_ENTERPRISE_ALACARTE_TITLE=''
3 changes: 1 addition & 2 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ ALGOLIA_SEARCH_API_KEY=''
ALGOLIA_INDEX_NAME=''
AUTHN_MINIMAL_HEADER=true
MINIMAL_HEADER=true
EDX_FOR_BUSINESS_TITLE=''
EDX_FOR_ONLINE_EDU_TITLE=''
EDX_FOR_SUBSCRIPTION_TITLE=''
EDX_ENTERPRISE_ALACARTE_TITLE=''
FEATURE_LANGUAGE_FACET=true
HOTJAR_APP_ID=''
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ To run this project locally:

.. code-block::
EDX_FOR_BUSINESS_TITLE='' # default = 'Business'
EDX_FOR_SUBSCRIPTION_TITLE='' # default = 'Subscription'
EDX_ENTERPRISE_ALACARTE_TITLE='' # default = 'A la carte'
5. From repository root folder, run:
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ const { createConfig } = require('@edx/frontend-build');

module.exports = createConfig('jest', {
setupFiles: ['<rootDir>/src/setupTest.js'],
coveragePathIgnorePatterns: ['src/setupTest.js', 'src/i18n', 'src/components/aiCuration'],
coveragePathIgnorePatterns: ['src/setupTest.js', 'src/i18n', 'src/components/aiCuration', 'src/index.jsx'],
});
2 changes: 1 addition & 1 deletion src/components/app/tests/App.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mockWindowLocations();

const mockConfig = () => ({
HUBSPOT_MARKETING_URL: 'http://bobsdooremporium.com',
EDX_FOR_BUSINESS_TITLE: 'ayylmao',
EDX_FOR_SUBSCRIPTION_TITLE: 'ayylmao',
EDX_ENTERPRISE_ALACARTE_TITLE: 'baz',
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/catalogInfoModal/CatalogInfoModal.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('Course info modal works as expected', () => {
Object.assign(defaultPropsCopy, courseTypeModalProps);

const businessQueryTitle = 'test-business-query-title';
process.env.EDX_FOR_BUSINESS_TITLE = businessQueryTitle;
process.env.EDX_FOR_SUBSCRIPTION_TITLE = businessQueryTitle;
defaultPropsCopy.selectedCourse.courseAssociatedCatalogs = [
businessQueryTitle,
];
Expand All @@ -119,7 +119,7 @@ describe('Course info modal works as expected', () => {
Object.assign(defaultPropsCopy, courseTypeModalProps);

const businessQueryTitle = 'test-business-query-title';
process.env.EDX_FOR_BUSINESS_TITLE = businessQueryTitle;
process.env.EDX_FOR_SUBSCRIPTION_TITLE = businessQueryTitle;
defaultPropsCopy.selectedCourse.courseAssociatedCatalogs = [
businessQueryTitle,
];
Expand Down
2 changes: 1 addition & 1 deletion src/components/catalogPage/CatalogPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jest.mock('react-instantsearch-dom', () => ({
// Thus we're mocking the config here.
const mockConfig = () => ({
HUBSPOT_MARKETING_URL: 'http://bobsdooremporium.com',
EDX_FOR_BUSINESS_TITLE: 'ayylmao',
EDX_FOR_SUBSCRIPTION_TITLE: 'ayylmao',
EDX_ENTERPRISE_ALACARTE_TITLE: 'baz',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ const messages = defineMessages({
defaultMessage: 'A la carte',
description: 'Badge text for the `A La Carte` catalog badge.',
},
'catalogSearchResults.businessBadge': {
id: 'catalogSearchResults.businessBadge',
defaultMessage: 'Business',
description: 'Badge text for the `Business` catalog badge.',
},
'catalogSearchResults.subscriptionBadge': {
id: 'catalogSearchResults.subscriptionBadge',
defaultMessage: 'Subscription',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const SearchDataWrapper = ({
);

const mockConfig = () => ({
EDX_FOR_BUSINESS_TITLE: 'ayylmao',
EDX_FOR_SUBSCRIPTION_TITLE: 'ayylmao',
EDX_ENTERPRISE_ALACARTE_TITLE: 'baz',
FEATURE_CARD_VIEW_ENABLED: 'True',
});
Expand Down Expand Up @@ -237,7 +237,7 @@ describe('Main Catalogs view works as expected', () => {
});

test('all courses rendered when search results available', async () => {
process.env.EDX_FOR_BUSINESS_TITLE = 'ayylmao';
process.env.EDX_FOR_SUBSCRIPTION_TITLE = 'ayylmao';
process.env.EDX_ENTERPRISE_ALACARTE_TITLE = 'baz';
render(
<SearchDataWrapper>
Expand Down Expand Up @@ -265,7 +265,7 @@ describe('Main Catalogs view works as expected', () => {
expect(screen.queryByText('Subscription')).toBeInTheDocument();
});
test('all courses rendered when search results available', async () => {
process.env.EDX_FOR_BUSINESS_TITLE = 'ayylmao';
process.env.EDX_FOR_SUBSCRIPTION_TITLE = 'ayylmao';
process.env.EDX_ENTERPRISE_ALACARTE_TITLE = 'baz';
features.CONSOLIDATE_SUBS_CATALOG = false;
render(
Expand Down Expand Up @@ -461,7 +461,7 @@ describe('Main Catalogs view works as expected', () => {
expect(screen.queryByText('About this course')).toBeInTheDocument();
});
test('exec ed search results text and card price', async () => {
process.env.EDX_FOR_BUSINESS_TITLE = 'ayylmao';
process.env.EDX_FOR_SUBSCRIPTION_TITLE = 'ayylmao';
process.env.EDX_ENTERPRISE_ALACARTE_TITLE = 'baz';
renderWithRouter(
<SearchDataWrapper>
Expand All @@ -484,7 +484,7 @@ describe('Main Catalogs view works as expected', () => {
expect(screen.queryByText('$100')).toBeInTheDocument();
});
test('all programs rendered when search results available', () => {
process.env.EDX_FOR_BUSINESS_TITLE = 'ayylmao';
process.env.EDX_FOR_SUBSCRIPTION_TITLE = 'ayylmao';
process.env.EDX_ENTERPRISE_ALACARTE_TITLE = 'baz';

renderWithRouter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const CatalogBadges = ({ row }) => {
</Badge>
)}
{row.original.enterprise_catalog_query_titles.includes(
process.env.EDX_FOR_BUSINESS_TITLE,
process.env.EDX_FOR_SUBSCRIPTION_TITLE,
) && (
<Badge variant="secondary" className="business-catalog padded-catalog">
{intl.formatMessage(messages['catalogSearchResults.subscriptionBadge'])}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const CatalogSelectionDeck = ({ intl, title, hide }) => {
</ul>
</div>
</SelectableBox>
<SelectableBox value={config.EDX_FOR_BUSINESS_TITLE} inputHidden={false} type="radio" aria-label="business select">
<SelectableBox value={config.EDX_FOR_SUBSCRIPTION_TITLE} inputHidden={false} type="radio" aria-label="subscription select">
<h3>{intl.formatMessage(messages['catalogSelectionDeck.edxSubscription.label'])}</h3>
<p>{intl.formatMessage(messages['catalogSelectionDeck.labelDetail'])}</p>
<ul className="catalog-list">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,11 @@
import { defineMessages } from '@edx/frontend-platform/i18n';

const messages = defineMessages({
'catalogSelectionDeck.edxForBusiness.badge': {
id: 'catalogSelectionDeck.edxForBusiness.badge',
defaultMessage: 'For businesses',
description: 'badge for catalog',
},
'catalogSelectionDeck.edxForBusiness.label': {
id: 'catalogSelectionDeck.edxForBusiness.label',
defaultMessage: 'Business subscription',
description: 'label for checkbox for filtering results',
},
'catalogSelectionDeck.edxSubscription.badge': {
id: 'catalogSelectionDeck.edxSubscription.badge',
defaultMessage: 'For all organizations',
description: 'badge for catalog',
},
'catalogSelectionDeck.edxSubscription.label': {
id: 'catalogSelectionDeck.edxSubscription.label',
defaultMessage: 'Subscription',
description: 'label for checkbox for filtering results',
},
'catalogSelectionDeck.edxForOnlineEdu.badge': {
id: 'catalogSelectionDeck.edxForOnlineEdu.badge',
defaultMessage: 'For educational institutions',
description: 'badge for catalog',
},
'catalogSelectionDeck.edxForOnlineEdu.label': {
id: 'catalogSelectionDeck.edxForOnlineEdu.label',
defaultMessage: 'Education subscription',
description: 'label for checkbox for filtering results',
},
'catalogSelectionDeck.labelDetail': {
id: 'catalogSelectionDeck.edxForOnlineEdu.labelDetail',
defaultMessage: 'Single, per learner price',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const label = 'fefifofum';
jest.mock('@edx/frontend-platform/config', () => ({
...jest.requireActual('@edx/frontend-platform/config'),
getConfig: jest.fn(() => ({
EDX_FOR_BUSINESS_TITLE: 'ayylmao',
EDX_FOR_SUBSCRIPTION_TITLE: 'ayylmao',
EDX_ENTERPRISE_ALACARTE_TITLE: 'baz',
})),
}));
Expand Down
2 changes: 1 addition & 1 deletion src/components/courseCard/CourseCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const CourseCard = ({
</Badge>
)}
{enterprise_catalog_query_titles?.includes(
process.env.EDX_FOR_BUSINESS_TITLE,
process.env.EDX_FOR_SUBSCRIPTION_TITLE,
) && (
<Badge
variant="secondary"
Expand Down
5 changes: 0 additions & 5 deletions src/components/courseCard/CourseCard.messages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ const messages = defineMessages({
defaultMessage: 'A la carte',
description: 'Badge text for the `A La Carte` catalog badge.',
},
'courseCard.businessBadge': {
id: 'courseCard.businessBadge',
defaultMessage: 'Business',
description: 'Badge text for the `Business` catalog badge.',
},
'courseCard.subscriptionBadge': {
id: 'courseCard.subscriptionBadge',
defaultMessage: 'Subscription',
Expand Down
6 changes: 3 additions & 3 deletions src/components/courseCard/CourseCard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('Course card works as expected', () => {
features.CONSOLIDATE_SUBS_CATALOG = true;
});
test('card renders as expected', () => {
process.env.EDX_FOR_BUSINESS_TITLE = 'ayylmao';
process.env.EDX_FOR_SUBSCRIPTION_TITLE = 'ayylmao';
process.env.EDX_ENTERPRISE_ALACARTE_TITLE = 'baz';
render(
<IntlProvider locale="en">
Expand All @@ -64,7 +64,7 @@ describe('Course card works as expected', () => {
expect(screen.queryByText('Subscription')).toBeInTheDocument();
});
test('card renders as expected with business subs', () => {
process.env.EDX_FOR_BUSINESS_TITLE = 'ayylmao';
process.env.EDX_FOR_SUBSCRIPTION_TITLE = 'ayylmao';
process.env.EDX_ENTERPRISE_ALACARTE_TITLE = 'baz';
features.CONSOLIDATE_SUBS_CATALOG = false;
render(
Expand All @@ -90,7 +90,7 @@ describe('Course card works as expected', () => {
await expect(screen.getByAltText(imageAltText).src).not.toBeUndefined;
});
test('exec ed card renders correct price from entitlement', async () => {
process.env.EDX_FOR_BUSINESS_TITLE = 'ayylmao';
process.env.EDX_FOR_SUBSCRIPTION_TITLE = 'ayylmao';
process.env.EDX_ENTERPRISE_ALACARTE_TITLE = 'baz';
render(
<IntlProvider locale="en">
Expand Down
2 changes: 1 addition & 1 deletion src/components/programCard/ProgramCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const ProgramCard = ({ intl, onClick, original }) => {
process.env.EDX_ENTERPRISE_ALACARTE_TITLE,
);
const businessCatalogRequested = enterprise_catalog_query_titles?.includes(
process.env.EDX_FOR_BUSINESS_TITLE,
process.env.EDX_FOR_SUBSCRIPTION_TITLE,
);
const imageSrc = card_image_url || defaultCardHeader;

Expand Down
5 changes: 0 additions & 5 deletions src/components/programCard/ProgramCard.messages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ const messages = defineMessages({
defaultMessage: 'A la carte',
description: 'Badge text for the `A La Carte` catalog badge.',
},
'ProgramCard.businessBadge': {
id: 'ProgramCard.businessBadge',
defaultMessage: 'Business',
description: 'Badge text for the `Business` catalog badge.',
},
'ProgramCard.subscriptionBadge': {
id: 'ProgramCard.subscriptionBadge',
defaultMessage: 'Subscription',
Expand Down
4 changes: 2 additions & 2 deletions src/components/programCard/ProgramCard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { IntlProvider } from '@edx/frontend-platform/i18n';
import ProgramCard from './ProgramCard';

const mockConfig = () => ({
EDX_FOR_BUSINESS_TITLE: 'ayylmao',
EDX_FOR_SUBSCRIPTION_TITLE: 'ayylmao',
EDX_ENTERPRISE_ALACARTE_TITLE: 'baz',
FEATURE_CARD_VIEW_ENABLED: 'True',
});
Expand All @@ -33,7 +33,7 @@ const defaultProps = {

describe('Program card works as expected', () => {
test('card renders as expected', () => {
process.env.EDX_FOR_BUSINESS_TITLE = 'ayylmao';
process.env.EDX_FOR_SUBSCRIPTION_TITLE = 'ayylmao';
process.env.EDX_ENTERPRISE_ALACARTE_TITLE = 'baz';
render(
<IntlProvider locale="en">
Expand Down
2 changes: 1 addition & 1 deletion src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ initialize({
ALGOLIA_SEARCH_API_KEY: process.env.ALGOLIA_SEARCH_API_KEY || null,
ALGOLIA_INDEX_NAME: process.env.ALGOLIA_INDEX_NAME || null,
HUBSPOT_MARKETING_URL: process.env.HUBSPOT_MARKETING_URL || null,
EDX_FOR_BUSINESS_TITLE: process.env.EDX_FOR_BUSINESS_TITLE || null,
EDX_FOR_SUBSCRIPTION_TITLE: process.env.EDX_FOR_SUBSCRIPTION_TITLE || null,
EDX_ENTERPRISE_ALACARTE_TITLE:
process.env.EDX_ENTERPRISE_ALACARTE_TITLE || null,
FEATURE_CARD_VIEW_ENABLED:
Expand Down
2 changes: 1 addition & 1 deletion src/utils/catalogUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const nowDate = new Date(Date.now());

function checkSubscriptions(courseAssociatedCatalogs) {
const inSubscription = courseAssociatedCatalogs.includes(
process.env.EDX_FOR_BUSINESS_TITLE,
process.env.EDX_FOR_SUBSCRIPTION_TITLE,
);
if (inSubscription) {
return 'Included in subscription catalog';
Expand Down

0 comments on commit bfb2f3b

Please sign in to comment.