Skip to content

Commit

Permalink
chore: remove bootcamps
Browse files Browse the repository at this point in the history
  • Loading branch information
zawan-ila committed Feb 6, 2025
1 parent 3044465 commit 6b59d5a
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ exports[`Collapsible Course Run renders correctly restriction type field for ext
helpText={
<div>
<p>
The identifier for a product variant. This is used to link a course run to a product variant for external LOBs (i.e; ExecEd & Bootcamps).
The identifier for a product variant. This is used to link a course run to a product variant for external LOBs (e.g; ExecEd).
</p>
</div>
}
Expand Down Expand Up @@ -771,7 +771,7 @@ exports[`Collapsible Course Run renders correctly restriction type field for ext
helpText={
<div>
<p>
The identifier for a product variant. This is used to link a course run to a product variant for external LOBs (i.e; ExecEd & Bootcamps).
The identifier for a product variant. This is used to link a course run to a product variant for external LOBs (e.g; ExecEd).
</p>
</div>
}
Expand Down Expand Up @@ -1439,7 +1439,7 @@ exports[`Collapsible Course Run renders correctly variant_id field for external
helpText={
<div>
<p>
The identifier for a product variant. This is used to link a course run to a product variant for external LOBs (i.e; ExecEd & Bootcamps).
The identifier for a product variant. This is used to link a course run to a product variant for external LOBs (e.g; ExecEd).
</p>
</div>
}
Expand Down
48 changes: 0 additions & 48 deletions src/components/Header/__snapshots__/Header.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,6 @@ exports[`Header renders the correct header 1`] = `
</a>
</Link>
</div>
<div
className="col-auto justify-content-start"
>
<Link
className=""
to="/?course_type=bootcamp-2u"
>
<a
className=""
href="/?course_type=bootcamp-2u"
onClick={[Function]}
>
Bootcamps
</a>
</Link>
</div>
<div
className="col-auto justify-content-end"
>
Expand Down Expand Up @@ -309,22 +293,6 @@ exports[`Header renders the header correctly when toggling is allowed, and dark
</a>
</Link>
</div>
<div
className="col-auto justify-content-start"
>
<Link
className=""
to="/?course_type=bootcamp-2u"
>
<a
className=""
href="/?course_type=bootcamp-2u"
onClick={[Function]}
>
Bootcamps
</a>
</Link>
</div>
<div
className="col-auto justify-content-end"
>
Expand Down Expand Up @@ -549,22 +517,6 @@ exports[`Header renders the header correctly when users pass a querystring param
</a>
</Link>
</div>
<div
className="col-auto justify-content-start"
>
<Link
className=""
to="/?course_type=bootcamp-2u"
>
<a
className=""
href="/?course_type=bootcamp-2u"
onClick={[Function]}
>
Bootcamps
</a>
</Link>
</div>
<div
className="col-auto justify-content-end"
>
Expand Down
3 changes: 0 additions & 3 deletions src/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ const Header = ({ darkModeOn, toggleDarkMode }) => {
<div className="col-auto justify-content-start">
<Link to="/?course_type=executive-education-2u" className={disableLink('executive-education-2u')}>Executive Education</Link>
</div>
<div className="col-auto justify-content-start">
<Link to="/?course_type=bootcamp-2u" className={disableLink('bootcamp-2u')}>Bootcamps</Link>
</div>

{allowDarkModeToggle
&& (
Expand Down
2 changes: 0 additions & 2 deletions src/data/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const FORMAT_DATE_MATCHER = /20\d{2}-(0\d{1}|1[0-2])-([0-2]\d{1}|3[0-1])/;
const NORMALIZE_DATE_MATCHER = /20\d{2}\/(0\d{1}|1[0-2])\/([0-2]\d{1}|3[0-1])/;

const EXECUTIVE_EDUCATION_SLUG = 'executive-education-2u';
const BOOTCAMP_SLUG = 'bootcamp-2u';

const COURSE_URL_SLUG_PATTERN_OLD = '^[a-z0-9_]+(?:-[a-z0-9_]+)*$';
const COURSE_URL_SLUG_PATTERN_NEW = '^learn/[a-z0-9_]+(?:-?[a-z0-9_]+)*/[a-z0-9_]+(?:-?[a-z0-9_]+)*$';
Expand Down Expand Up @@ -62,7 +61,6 @@ export {
COURSE_EXEMPT_FIELDS,
COURSE_RUN_NON_EXEMPT_FIELDS,
EXECUTIVE_EDUCATION_SLUG,
BOOTCAMP_SLUG,
COURSE_URL_SLUG_PATTERN,
COURSE_URL_SLUG_PATTERN_NEW,
COURSE_URL_SLUG_PATTERN_OLD,
Expand Down
2 changes: 1 addition & 1 deletion src/helpText.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const courseRunVariantIdHelp = (
<div>
<p>
The identifier for a product variant. This is used to link a course run to a product variant for external LOBs
(i.e; ExecEd & Bootcamps).
(e.g; ExecEd).
</p>
</div>
);
Expand Down
8 changes: 0 additions & 8 deletions src/setupTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ process.env.COURSE_URL_SLUGS_PATTERN = `{
"default": {
"slug_format": "^learn/[a-z0-9_]+(?:-?[a-z0-9_]+)*/[a-z0-9_]+(?:-?[a-z0-9_]+)*$|^[a-z0-9_]+(?:-[a-z0-9_]+)*$",
"error_msg": "Course URL slug contains lowercase letters, numbers, underscores, and dashes only and must be in the format <custom-url-slug> or learn/<primary_subject>/<org-slug>-<course_slug>."
},
"bootcamp-2u": {
"slug_format": "^boot-camps/[a-z0-9_]+(?:-?[a-z0-9_]+)*/[a-z0-9_]+(?:-?[a-z0-9_]+)*$|^[a-z0-9_]+(?:-[a-z0-9_]+)*$",
"error_msg": "Course URL slug contains lowercase letters, numbers, underscores, and dashes only and must be in the format <custom-url-slug> or boot-camps/<primary_subject>/<org-slug>-<course_slug>."
}
},
"external-source": {
Expand All @@ -31,10 +27,6 @@ process.env.COURSE_URL_SLUGS_PATTERN = `{
"executive-education-2u": {
"slug_format": "^executive-education/[a-z0-9_]+(?:-?[a-z0-9_]+)*$|^[a-z0-9_]+(?:-[a-z0-9_]+)*$",
"error_msg": "Course URL slug contains lowercase letters, numbers, underscores, and dashes only and must be in the format <custom-url-slug> or executive-education/<org-slug>-<course_slug>."
},
"bootcamp-2u": {
"slug_format": "^boot-camps/[a-z0-9_]+(?:-?[a-z0-9_]+)*/[a-z0-9_]+(?:-?[a-z0-9_]+)*$|^[a-z0-9_]+(?:-[a-z0-9_]+)*$",
"error_msg": "Course URL slug contains lowercase letters, numbers, underscores, and dashes only and must be in the format <custom-url-slug> or boot-camps/<primary_subject>/<org-slug>-<course_slug>."
}
}
}`;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import qs from 'query-string';

import {
COURSE_EXEMPT_FIELDS, COURSE_RUN_NON_EXEMPT_FIELDS, COURSE_URL_SLUG_PATTERN_OLD,
MASTERS_TRACK, COURSE_URL_SLUG_VALIDATION_MESSAGE, EXECUTIVE_EDUCATION_SLUG, BOOTCAMP_SLUG,
MASTERS_TRACK, COURSE_URL_SLUG_VALIDATION_MESSAGE, EXECUTIVE_EDUCATION_SLUG,
RESTRICTION_TYPE_OPTIONS as restrictionTypeOptions,
} from '../data/constants';
import DiscoveryDataApiService from '../data/services/DiscoveryDataApiService';
Expand Down Expand Up @@ -220,7 +220,7 @@ const isPristine = (initialValues, currentFormValues, runKey) => {
};

const isExternalCourse = (productSource, courseType) => (
productSource !== DEFAULT_PRODUCT_SOURCE && [EXECUTIVE_EDUCATION_SLUG, BOOTCAMP_SLUG].includes(courseType)
productSource !== DEFAULT_PRODUCT_SOURCE && [EXECUTIVE_EDUCATION_SLUG].includes(courseType)
);

const parseOptions = inChoices => inChoices.map(choice => ({ label: choice.display_name, value: choice.value }));
Expand Down
27 changes: 2 additions & 25 deletions src/utils/utils.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as utils from '.';
import { BOOTCAMP_SLUG, COURSE_URL_SLUG_PATTERN_OLD, EXECUTIVE_EDUCATION_SLUG } from '../data/constants';
import { COURSE_URL_SLUG_PATTERN_OLD, EXECUTIVE_EDUCATION_SLUG } from '../data/constants';
import { DEFAULT_PRODUCT_SOURCE } from '../data/constants/productSourceOptions';

const initialRuns = [
Expand Down Expand Up @@ -129,38 +129,15 @@ describe('getCourseUrlSlugPattern', () => {
});
},
);

it(
'returns the old course url slug pattern when courseType is bootcamp and updatedSlugFlag is false',
() => {
expect(
utils.getCourseUrlSlugPattern(false, 'external-source', BOOTCAMP_SLUG),
).toEqual({
slug_format: COURSE_URL_SLUG_PATTERN_OLD,
error_msg: 'Course URL slug contains lowercase letters, numbers, underscores, and dashes only.',
});
},
);

it(
'returns the bootcamp subdirectory slug pattern when courseType is bootcamp and updatedSlugFlag is true',
() => {
expect(
utils.getCourseUrlSlugPattern(true, 'external-source', BOOTCAMP_SLUG),
).toEqual(JSON.parse(COURSE_URL_SLUGS_PATTERN)['external-source'][BOOTCAMP_SLUG]);
},
);
});

describe('isExternalCourse', () => {
const EXTERNAL_COURSE_TYPES = [EXECUTIVE_EDUCATION_SLUG, BOOTCAMP_SLUG];
const EXTERNAL_COURSE_TYPES = [EXECUTIVE_EDUCATION_SLUG];
it('returns true if the product source is other than edx and course type is in EXTERNAL_COURSE_TYPES', () => {
expect(utils.isExternalCourse('external-source', EXTERNAL_COURSE_TYPES[0])).toBe(true);
expect(utils.isExternalCourse('external-source', EXTERNAL_COURSE_TYPES[1])).toBe(true);
});
it('returns false if the product source has a default value', () => {
expect(utils.isExternalCourse(DEFAULT_PRODUCT_SOURCE, EXTERNAL_COURSE_TYPES[0])).toBe(false);
expect(utils.isExternalCourse(DEFAULT_PRODUCT_SOURCE, EXTERNAL_COURSE_TYPES[1])).toBe(false);
});
it(
'returns false if the product source does not have a default value and course type is not in EXTERNAL_COURSE_TYPES',
Expand Down

0 comments on commit 6b59d5a

Please sign in to comment.