diff --git a/client/config/cert-and-project-map.test.ts b/client/config/cert-and-project-map.test.ts deleted file mode 100644 index 3ab2883918d..00000000000 --- a/client/config/cert-and-project-map.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { uniq } from 'lodash'; -import { - currentCertifications, - upcomingCertifications, - legacyCertifications -} from '../../shared/config/certification-settings'; -import { - currentCertTitles, - upcomingCertTitles, - legacyCertTitles -} from './cert-and-project-map'; - -describe('cert-and-project-map', () => { - describe('currentCertTitles', () => { - it('should correspond to the currentCertifications config', () => { - expect(currentCertTitles).toHaveLength(uniq(currentCertTitles).length); - expect(currentCertTitles).toHaveLength(currentCertifications.length); - }); - }); - - describe('upcomingCertTitles', () => { - it('should correspond to the upcomingCertifications config', () => { - expect(upcomingCertTitles).toHaveLength(uniq(upcomingCertTitles).length); - expect(upcomingCertTitles).toHaveLength(upcomingCertifications.length); - }); - }); - - describe('legacyCertTitles', () => { - it('should correspond to the legacyCertifications config', () => { - expect(legacyCertTitles).toHaveLength(uniq(legacyCertTitles).length); - expect(legacyCertTitles).toHaveLength(legacyCertifications.length); - }); - }); -}); diff --git a/client/config/cert-and-project-map.ts b/client/config/cert-and-project-map.ts index 94fc687d793..5d47de71446 100644 --- a/client/config/cert-and-project-map.ts +++ b/client/config/cert-and-project-map.ts @@ -881,29 +881,19 @@ const liveCerts = showUpcomingChanges : [...currentCerts, ...legacyCerts, fullstackCert]; type CertsToProjects = Record< - (typeof allStandardCerts)[number]['title'], + (typeof allStandardCerts)[number]['certSlug'], (typeof allStandardCerts)[number]['projects'] >; const certsToProjects = allStandardCerts.reduce((acc, curr) => { return { ...acc, - [curr.title]: curr.projects + [curr.certSlug]: curr.projects }; }, {} as CertsToProjects); -const currentCertTitles = currentCerts.map(({ title }) => title); -const legacyCertTitles = legacyCerts.map(({ title }) => title); -const upcomingCertTitles = upcomingCerts.map(({ title }) => title); - export type CertTitle = | (typeof liveCerts)[number]['title'] | 'Legacy Full Stack'; -export { - currentCertTitles, - legacyCertTitles, - upcomingCertTitles, - liveCerts, - certsToProjects -}; +export { liveCerts, certsToProjects }; diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index 948629d2582..37da9f54c3c 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -1047,50 +1047,50 @@ } }, "title": { - "Responsive Web Design": "Responsive Web Design", - "responsive-web-design": "Responsive Web Design Certification", - "JavaScript Algorithms and Data Structures": "Legacy JavaScript Algorithms and Data Structures", - "javascript-algorithms-and-data-structures": "Legacy JavaScript Algorithms and Data Structures Certification", - "javascript-algorithms-and-data-structures-v8": "JavaScript Algorithms and Data Structures (Beta) Certification", - "Front End Development Libraries": "Front End Development Libraries", - "front-end-development-libraries": "Front End Development Libraries Certification", - "Data Visualization": "Data Visualization", - "data-visualization": "Data Visualization Certification", - "Relational Database": "Relational Database", - "relational-database-v8": "Relational Database Certification", - "Back End Development and APIs": "Back End Development and APIs", - "back-end-development-and-apis": "Back End Development and APIs Certification", - "Quality Assurance": "Quality Assurance", - "quality-assurance-v7": "Quality Assurance Certification", - "Scientific Computing with Python": "Scientific Computing with Python", - "scientific-computing-with-python-v7": "Scientific Computing with Python Certification", - "Data Analysis with Python": "Data Analysis with Python", - "data-analysis-with-python-v7": "Data Analysis with Python Certification", - "Information Security": "Information Security", - "information-security-v7": "Information Security Certification", - "Machine Learning with Python": "Machine Learning with Python", - "machine-learning-with-python-v7": "Machine Learning with Python Certification", - "College Algebra with Python": "College Algebra with Python", - "college-algebra-with-python-v8": "College Algebra with Python Certification", - "Foundational C# with Microsoft": "Foundational C# with Microsoft", - "foundational-c-sharp-with-microsoft": "Foundational C# with Microsoft Certification", - "A2 English for Developers": "A2 English for Developers", - "a2-english-for-developers": "A2 English for Developers Certification", - "B1 English for Developers": "B1 English for Developers", - "b1-english-for-developers": "B1 English for Developers Certification", - "Full Stack Developer": "Full Stack Developer", - "full-stack-developer-v9": "Certified Full Stack Developer", - "Legacy Front End": "Legacy Front End", - "legacy-front-end": "Legacy Front End Certification", - "Legacy Back End": "Legacy Back End", - "legacy-back-end": "Legacy Back End Certification", - "Legacy Data Visualization": "Legacy Data Visualization", - "legacy-data-visualization": "Legacy Data Visualization Certification", - "Legacy Information Security and Quality Assurance": "Legacy Information Security and Quality Assurance", - "information-security-and-quality-assurance": "Legacy Information Security and Quality Assurance Certification", - "Legacy Full Stack Certification": "Legacy Full Stack Certification", - "Legacy Full Stack": "Legacy Full Stack", - "full-stack": "Legacy Full Stack Certification" + "responsive-web-design": "Responsive Web Design", + "responsive-web-design-cert": "Responsive Web Design Certification", + "javascript-algorithms-and-data-structures": "Legacy JavaScript Algorithms and Data Structures", + "javascript-algorithms-and-data-structures-cert": "Legacy JavaScript Algorithms and Data Structures Certification", + "javascript-algorithms-and-data-structures-v8": "JavaScript Algorithms and Data Structures (Beta)", + "javascript-algorithms-and-data-structures-v8-cert": "JavaScript Algorithms and Data Structures (Beta) Certification", + "front-end-development-libraries": "Front End Development Libraries", + "front-end-development-libraries-cert": "Front End Development Libraries Certification", + "data-visualization": "Data Visualization", + "data-visualization-cert": "Data Visualization Certification", + "relational-database-v8": "Relational Database", + "relational-database-v8-cert": "Relational Database Certification", + "back-end-development-and-apis": "Back End Development and APIs", + "back-end-development-and-apis-cert": "Back End Development and APIs Certification", + "quality-assurance-v7": "Quality Assurance", + "quality-assurance-v7-cert": "Quality Assurance Certification", + "scientific-computing-with-python-v7": "Scientific Computing with Python", + "scientific-computing-with-python-v7-cert": "Scientific Computing with Python Certification", + "data-analysis-with-python-v7": "Data Analysis with Python", + "data-analysis-with-python-v7-cert": "Data Analysis with Python Certification", + "information-security-v7": "Information Security", + "information-security-v7-cert": "Information Security Certification", + "machine-learning-with-python-v7": "Machine Learning with Python", + "machine-learning-with-python-v7-cert": "Machine Learning with Python Certification", + "college-algebra-with-python-v8": "College Algebra with Python", + "college-algebra-with-python-v8-cert": "College Algebra with Python Certification", + "foundational-c-sharp-with-microsoft": "Foundational C# with Microsoft", + "foundational-c-sharp-with-microsoft-cert": "Foundational C# with Microsoft Certification", + "a2-english-for-developers": "A2 English for Developers", + "a2-english-for-developers-cert": "A2 English for Developers Certification", + "b1-english-for-developers": "B1 English for Developers", + "b1-english-for-developers-cert": "B1 English for Developers Certification", + "full-stack-developer-v9": "Full Stack Developer", + "full-stack-developer-v9-cert": "Full Stack Developer Certification", + "legacy-front-end": "Legacy Front End", + "legacy-front-end-cert": "Legacy Front End Certification", + "legacy-back-end": "Legacy Back End", + "legacy-back-end-cert": "Legacy Back End Certification", + "legacy-data-visualization": "Legacy Data Visualization", + "legacy-data-visualization-cert": "Legacy Data Visualization Certification", + "information-security-and-quality-assurance": "Legacy Information Security and Quality Assurance", + "information-security-and-quality-assurance-cert": "Legacy Information Security and Quality Assurance Certification", + "full-stack": "Legacy Full Stack", + "full-stack-cert": "Legacy Full Stack Certification" } }, "certification-card": { diff --git a/client/src/client-only-routes/show-certification.tsx b/client/src/client-only-routes/show-certification.tsx index 233afdf98b5..bdcec7064e1 100644 --- a/client/src/client-only-routes/show-certification.tsx +++ b/client/src/client-only-routes/show-certification.tsx @@ -35,9 +35,8 @@ import { import { PaymentContext } from '../../../shared/config/donation-settings'; import ribbon from '../assets/images/ribbon.svg'; import { + Certification, CertSlug, - certTypes, - certTypeTitleMap, linkedInCredentialIds } from '../../../shared/config/certification-settings'; import MultiTierDonationForm from '../components/Donation/multi-tier-donation-form'; @@ -327,8 +326,7 @@ const ShowCertification = (props: ShowCertificationProps): JSX.Element => { ); - const isMicrosoftCert = - certTitle === certTypeTitleMap[certTypes.foundationalCSharpV8]; + const isMicrosoftCert = certSlug === Certification.FoundationalCSharp; return ( @@ -376,7 +374,7 @@ const ShowCertification = (props: ShowCertificationProps): JSX.Element => { ? 'certification.fulltextNoHours' : 'certification.fulltext' } - title={certTitle} + title={t(`certification.title.${certSlug}`, certTitle)} >

placeholder

@@ -388,7 +386,7 @@ const ShowCertification = (props: ShowCertificationProps): JSX.Element => {

{{ - title: t(`certification.title.${certTitle}`, certTitle) + title: t(`certification.title.${certSlug}`, certTitle) }}

@@ -487,7 +485,7 @@ const ShowCertification = (props: ShowCertificationProps): JSX.Element => { {signedInUserName === username ? shareCertBtns : ''} - +
diff --git a/client/src/client-only-routes/show-project-links.tsx b/client/src/client-only-routes/show-project-links.tsx index c6a18ddd399..df5d3a1adb2 100644 --- a/client/src/client-only-routes/show-project-links.tsx +++ b/client/src/client-only-routes/show-project-links.tsx @@ -7,10 +7,7 @@ import { Table, Spacer } from '@freecodecamp/ui'; import { Link } from '../components/helpers'; import ProjectModal from '../components/SolutionViewer/project-modal'; import type { CompletedChallenge, User } from '../redux/prop-types'; -import { - certsToProjects, - type CertTitle -} from '../../config/cert-and-project-map'; +import { certsToProjects } from '../../config/cert-and-project-map'; import { SolutionDisplayWidget } from '../components/solution-display-widget'; import ProjectPreviewModal from '../templates/Challenges/components/project-preview-modal'; @@ -20,8 +17,9 @@ import { openModal } from '../templates/Challenges/redux/actions'; import { regeneratePathAndHistory } from '../../../shared/utils/polyvinyl'; import '../components/layouts/project-links.css'; +import { Certification } from '../../../shared/config/certification-settings'; interface ShowProjectLinksProps { - certName: string; + certSlug: Certification; name: string; user: User; openModal: (arg: string) => void; @@ -101,28 +99,27 @@ const ShowProjectLinks = (props: ShowProjectLinksProps): JSX.Element => { ); }; - const ProjectsFor = ({ certName }: { certName: CertTitle }) => { - if (certName === 'Legacy Full Stack') { + const ProjectsFor = ({ certSlug }: { certSlug: Certification }) => { + if (certSlug === Certification.LegacyFullStack) { const certs = [ - { title: 'Responsive Web Design' }, - { title: 'Legacy JavaScript Algorithms and Data Structures' }, - { title: 'Front End Development Libraries' }, - { title: 'Data Visualization' }, - { title: 'Back End Development and APIs' }, - { title: 'Legacy Information Security and Quality Assurance' } + { name: Certification.RespWebDesign }, + { name: Certification.JsAlgoDataStruct }, + { name: Certification.LegacyFrontEnd }, + { name: Certification.LegacyDataVis }, + { name: Certification.LegacyBackEnd }, + { name: Certification.LegacyInfoSecQa } ] as const; return ( <> {certs.map((cert, ind) => { - const projects = certsToProjects[cert.title]; - const { certSlug } = projects[0]; - const certLocation = `/certification/${username}/${certSlug}`; + const certLocation = `/certification/${username}/${cert.name}`; + return ( - {t(`certification.title.${cert.title}`, cert.title)} + {t(`certification.title.${cert.name}`)} @@ -132,7 +129,7 @@ const ShowProjectLinks = (props: ShowProjectLinksProps): JSX.Element => { ); } - const projects = certsToProjects[certName]; + const projects = certsToProjects[certSlug]; return ( <> {projects.map(({ link, title, id }) => ( @@ -150,17 +147,17 @@ const ShowProjectLinks = (props: ShowProjectLinksProps): JSX.Element => { }; const { - certName, + certSlug, name, user: { username } } = props; const { completedChallenge, showCode, projectTitle } = solutionState; const examResults = completedChallenge?.examResults; - const getCertHeading = (certName: string) => { - if (certName == 'Legacy Full Stack') { + const getCertHeading = (cert: Certification) => { + if (cert === Certification.LegacyFullStack) { return 'certification.project.heading-legacy-full-stack'; - } else if (certName == 'Foundational C# with Microsoft') { + } else if (cert === Certification.FoundationalCSharp) { return 'certification.project.heading-exam'; } else { return 'certification.project.heading'; @@ -177,15 +174,9 @@ const ShowProjectLinks = (props: ShowProjectLinksProps): JSX.Element => { } : null; - const isCertName = (maybeCertName: string): maybeCertName is CertTitle => { - if (maybeCertName === 'Legacy Full Stack') return true; - return maybeCertName in certsToProjects; - }; - if (!isCertName(certName)) return
Unknown Certification
; - return (
- {t(getCertHeading(certName), { user: name })} + {t(getCertHeading(certSlug), { user: name })} @@ -196,7 +187,7 @@ const ShowProjectLinks = (props: ShowProjectLinksProps): JSX.Element => { - +
@@ -216,7 +207,7 @@ const ShowProjectLinks = (props: ShowProjectLinksProps): JSX.Element => { /> - {certName != 'Foundational C# with Microsoft' && ( + {certSlug !== Certification.FoundationalCSharp && ( If you suspect that any of these projects violate the{' '} {t('buttons.view-cert-title', { - certTitle: t(`certification.title.${cert.certSlug}`) + certTitle: t(`certification.title.${cert.certSlug}-cert`) })} diff --git a/client/src/components/profile/components/time-line.tsx b/client/src/components/profile/components/time-line.tsx index 3a9c6d663e0..4a22a212a44 100644 --- a/client/src/components/profile/components/time-line.tsx +++ b/client/src/components/profile/components/time-line.tsx @@ -267,7 +267,7 @@ function useIdToNameMap(t: TFunction): Map { const idToNameMap = new Map(); for (const id of getCertIds()) { const certPath = getPathFromID(id); - const certName = t(`certification.title.${certPath}`); + const certName = t(`certification.title.${certPath}-cert`); idToNameMap.set(id, { challengeTitle: certName, certPath: certPath diff --git a/client/src/components/settings/certification.tsx b/client/src/components/settings/certification.tsx index 2bd282baf6f..ce10b65c76b 100644 --- a/client/src/components/settings/certification.tsx +++ b/client/src/components/settings/certification.tsx @@ -2,7 +2,6 @@ import { find } from 'lodash-es'; import React, { MouseEvent, useState } from 'react'; import { withTranslation } from 'react-i18next'; import type { TFunction } from 'i18next'; -import { createSelector } from 'reselect'; import ScrollableAnchor, { configureAnchors } from 'react-scrollable-anchor'; import { connect } from 'react-redux'; import { Table, Button, Spacer } from '@freecodecamp/ui'; @@ -11,20 +10,17 @@ import { regeneratePathAndHistory } from '../../../../shared/utils/polyvinyl'; import ProjectPreviewModal from '../../templates/Challenges/components/project-preview-modal'; import ExamResultsModal from '../SolutionViewer/exam-results-modal'; import { openModal } from '../../templates/Challenges/redux/actions'; -import { - currentCertTitles, - legacyCertTitles, - upcomingCertTitles, - certsToProjects, - type CertTitle -} from '../../../config/cert-and-project-map'; +import { certsToProjects } from '../../../config/cert-and-project-map'; import { FlashMessages } from '../Flash/redux/flash-messages'; import ProjectModal from '../SolutionViewer/project-modal'; import { FullWidthRow, Link } from '../helpers'; import { SolutionDisplayWidget } from '../solution-display-widget'; import { Certification, - certSlugTypeMap + certSlugTypeMap, + currentCertifications, + legacyCertifications, + upcomingCertifications } from '../../../../shared/config/certification-settings'; import env from '../../../config/env.json'; @@ -48,39 +44,18 @@ const mapDispatchToProps = { openModal }; -const isCertSelector = ({ +const createCertifiedMap = ({ is2018DataVisCert, isApisMicroservicesCert, isJsAlgoDataStructCert, - isBackEndCert, - isDataVisCert, - isFrontEndCert, isInfosecQaCert, isQaCertV7, isInfosecCertV7, isFrontEndLibsCert, - isFullStackCert, - isRespWebDesignCert, - isSciCompPyCertV7, - isDataAnalysisPyCertV7, - isMachineLearningPyCertV7, - isRelationalDatabaseCertV8, - isCollegeAlgebraPyCertV8, - isFoundationalCSharpCertV8, - isJsAlgoDataStructCertV8 -}: ClaimedCertifications) => ({ - is2018DataVisCert, - isApisMicroservicesCert, - isJsAlgoDataStructCert, - isBackEndCert, - isDataVisCert, - isFrontEndCert, - isInfosecQaCert, - isQaCertV7, - isInfosecCertV7, - isFrontEndLibsCert, - isFullStackCert, isRespWebDesignCert, + isDataVisCert, + isFrontEndCert, + isBackEndCert, isSciCompPyCertV7, isDataAnalysisPyCertV7, isMachineLearningPyCertV7, @@ -88,56 +63,36 @@ const isCertSelector = ({ isCollegeAlgebraPyCertV8, isFoundationalCSharpCertV8, isJsAlgoDataStructCertV8 +}: ClaimedCertifications): Record< + Exclude, + boolean +> => ({ + [Certification.RespWebDesign]: isRespWebDesignCert, + [Certification.JsAlgoDataStruct]: isJsAlgoDataStructCert, + [Certification.FrontEndDevLibs]: isFrontEndLibsCert, + [Certification.DataVis]: is2018DataVisCert, + [Certification.BackEndDevApis]: isApisMicroservicesCert, + [Certification.QualityAssurance]: isQaCertV7, + [Certification.InfoSec]: isInfosecCertV7, + [Certification.SciCompPy]: isSciCompPyCertV7, + [Certification.DataAnalysisPy]: isDataAnalysisPyCertV7, + [Certification.MachineLearningPy]: isMachineLearningPyCertV7, + [Certification.RelationalDb]: isRelationalDatabaseCertV8, + [Certification.CollegeAlgebraPy]: isCollegeAlgebraPyCertV8, + [Certification.FoundationalCSharp]: isFoundationalCSharpCertV8, + [Certification.LegacyFrontEnd]: isFrontEndCert, + [Certification.LegacyDataVis]: isDataVisCert, + [Certification.LegacyBackEnd]: isBackEndCert, + [Certification.LegacyInfoSecQa]: isInfosecQaCert, + // LegacyFullStack cannot be handled by this because there are no projects to + // be rendered. The new FullStackDeveloper certification is a normal + // certification with projects. + [Certification.FullStackDeveloper]: false, + [Certification.A2English]: false, + [Certification.B1English]: false, + [Certification.JsAlgoDataStructNew]: isJsAlgoDataStructCertV8 }); -const isCertMapSelector = createSelector( - isCertSelector, - ({ - is2018DataVisCert, - isApisMicroservicesCert, - isJsAlgoDataStructCert, - isInfosecQaCert, - isQaCertV7, - isInfosecCertV7, - isFrontEndLibsCert, - isRespWebDesignCert, - isDataVisCert, - isFrontEndCert, - isBackEndCert, - isSciCompPyCertV7, - isDataAnalysisPyCertV7, - isMachineLearningPyCertV7, - isRelationalDatabaseCertV8, - isCollegeAlgebraPyCertV8, - isFoundationalCSharpCertV8, - isJsAlgoDataStructCertV8 - }) => ({ - 'Responsive Web Design': isRespWebDesignCert, - 'Legacy JavaScript Algorithms and Data Structures': isJsAlgoDataStructCert, - 'Front End Development Libraries': isFrontEndLibsCert, - 'Data Visualization': is2018DataVisCert, - 'Back End Development and APIs': isApisMicroservicesCert, - 'Quality Assurance': isQaCertV7, - 'Information Security': isInfosecCertV7, - 'Scientific Computing with Python': isSciCompPyCertV7, - 'Data Analysis with Python': isDataAnalysisPyCertV7, - 'Machine Learning with Python': isMachineLearningPyCertV7, - 'Relational Database': isRelationalDatabaseCertV8, - 'College Algebra with Python': isCollegeAlgebraPyCertV8, - 'Foundational C# with Microsoft': isFoundationalCSharpCertV8, - 'Legacy Front End': isFrontEndCert, - 'Legacy Data Visualization': isDataVisCert, - 'Legacy Back End': isBackEndCert, - 'Legacy Information Security and Quality Assurance': isInfosecQaCert, - // Certification. - 'Certified Full Stack Developer': false, - 'Upcoming Python Certification': false, - 'A2 English for Developers': false, - 'B1 English for Developers': false, - 'JavaScript Algorithms and Data Structures (Beta)': isJsAlgoDataStructCertV8 - }) -); - const honestyInfoMessage = { type: 'info', message: FlashMessages.HonestFirst @@ -192,27 +147,21 @@ const LegacyFullStack = (props: CertificationSettingsProps) => {

- {t('certification.title.Legacy Full Stack Certification')} + {t(`certification.title.${Certification.LegacyFullStack}-cert`)}

{t('settings.claim-legacy', { - cert: t('certification.title.Legacy Full Stack Certification') + cert: t(`certification.title.${Certification.LegacyFullStack}-cert`) })}

    -
  • {t('certification.title.Responsive Web Design')}
  • -
  • - {t('certification.title.JavaScript Algorithms and Data Structures')} -
  • -
  • {t('certification.title.Front End Development Libraries')}
  • -
  • {t('certification.title.Data Visualization')}
  • -
  • {t('certification.title.Back End Development and APIs')}
  • -
  • - {t( - 'certification.title.Legacy Information Security and Quality Assurance' - )} -
  • +
  • {t(`certification.title.${Certification.RespWebDesign}`)}
  • +
  • {t(`certification.title.${Certification.JsAlgoDataStruct}`)}
  • +
  • {t(`certification.title.${Certification.LegacyFrontEnd}`)}
  • +
  • {t(`certification.title.${Certification.LegacyDataVis}`)}
  • +
  • {t(`certification.title.${Certification.LegacyBackEnd}`)}
  • +
  • {t(`certification.title.${Certification.LegacyInfoSecQa}`)}
@@ -228,7 +177,7 @@ const LegacyFullStack = (props: CertificationSettingsProps) => { > {t('buttons.show-cert')}{' '} - {t('certification.title.Legacy Full Stack')} + {t(`certification.title.${Certification.LegacyFullStack}`)} ) : ( @@ -242,7 +191,7 @@ const LegacyFullStack = (props: CertificationSettingsProps) => { > {t('buttons.claim-cert')}{' '} - {t('certification.title.Legacy Full Stack')} + {t(`certification.title.${Certification.LegacyFullStack}`)} )} @@ -273,8 +222,7 @@ function CertificationSettings(props: CertificationSettingsProps) { const handleSolutionModalHide = () => initialiseState(); - const getUserIsCertMap = () => isCertMapSelector(props); - + const isCertifiedMap = createCertifiedMap(props); const getProjectSolution = (projectId: string, projectTitle: string) => { const { completedChallenges, openModal } = props; const completedProject = find( @@ -327,20 +275,19 @@ function CertificationSettings(props: CertificationSettingsProps) { }; const Certification = ({ - certName, + certSlug, t }: { - certName: Exclude; + certSlug: Exclude; t: TFunction; }) => { - const { certSlug } = certsToProjects[certName][0]; return (

- {t(`certification.title.${certName}`, certName)} + {t(`certification.title.${certSlug}`, certSlug)}

@@ -351,8 +298,8 @@ function CertificationSettings(props: CertificationSettingsProps) {
@@ -363,14 +310,13 @@ function CertificationSettings(props: CertificationSettingsProps) { }; function ProjectsFor({ - certName, + certSlug, isCert }: { - certName: Exclude; + certSlug: Exclude; isCert: boolean; }) { const { username, isHonest, createFlashMessage, t, verifyCert } = props; - const { certSlug } = certsToProjects[certName][0]; const certLocation = `/certification/${username}/${certSlug}`; const handleClaim = (e: MouseEvent) => { @@ -383,7 +329,7 @@ function CertificationSettings(props: CertificationSettingsProps) { return ( <> - {certsToProjects[certName].map(({ link, title, id }) => ( + {certsToProjects[certSlug].map(({ link, title, id }) => ( @@ -400,12 +346,16 @@ function CertificationSettings(props: CertificationSettingsProps) { {isCert ? ( ) : ( )} @@ -419,18 +369,18 @@ function CertificationSettings(props: CertificationSettingsProps) { return (
{t('settings.headings.certs')} - {currentCertTitles.map(title => ( - + {currentCertifications.map(cert => ( + ))} {t('settings.headings.legacy-certs')} - {legacyCertTitles.map(title => ( - + {legacyCertifications.map(cert => ( + ))} {showUpcomingChanges && - upcomingCertTitles.map(title => ( - + upcomingCertifications.map(cert => ( + ))} { await expect(certInfoContainer).toBeVisible(); const certTitle = certInfoContainer.getByTestId('certification-title'); await expect(certTitle).toHaveText( - translations.certification.title['Responsive Web Design'] + translations.certification.title['responsive-web-design'] ); const footer = certWrapper.getByTestId('cert-footer'); @@ -195,7 +195,7 @@ test.describe('Certification page - Microsoft', () => { await expect(certInfoContainer).toBeVisible(); const certTitle = certInfoContainer.getByTestId('certification-title'); await expect(certTitle).toHaveText( - translations.certification.title['Foundational C# with Microsoft'] + translations.certification.title['foundational-c-sharp-with-microsoft'] ); const footer = certWrapper.getByTestId('cert-footer'); diff --git a/e2e/settings.spec.ts b/e2e/settings.spec.ts index 612f898a0ad..5846fa42546 100644 --- a/e2e/settings.spec.ts +++ b/e2e/settings.spec.ts @@ -22,28 +22,28 @@ const settingsObject = { }; const certifications = [ - translations.certification.title['Responsive Web Design'], - translations.certification.title['JavaScript Algorithms and Data Structures'], - translations.certification.title['Front End Development Libraries'], - translations.certification.title['Data Visualization'], - translations.certification.title['Relational Database'], - translations.certification.title['Back End Development and APIs'], - translations.certification.title['Quality Assurance'], - translations.certification.title['Scientific Computing with Python'], - translations.certification.title['Data Analysis with Python'], - translations.certification.title['Information Security'], - translations.certification.title['Machine Learning with Python'], - translations.certification.title['College Algebra with Python'], - translations.certification.title['Foundational C# with Microsoft'] + translations.certification.title['responsive-web-design'], + translations.certification.title[ + 'javascript-algorithms-and-data-structures-v8' + ], + translations.certification.title['front-end-development-libraries'], + translations.certification.title['data-visualization'], + translations.certification.title['relational-database-v8'], + translations.certification.title['back-end-development-and-apis'], + translations.certification.title['quality-assurance-v7'], + translations.certification.title['scientific-computing-with-python-v7'], + translations.certification.title['data-analysis-with-python-v7'], + translations.certification.title['information-security-v7'], + translations.certification.title['machine-learning-with-python-v7'], + translations.certification.title['college-algebra-with-python-v8'], + translations.certification.title['foundational-c-sharp-with-microsoft'] ]; const legacyCertifications = [ - translations.certification.title['Legacy Front End'], - translations.certification.title['Legacy Back End'], - translations.certification.title['Legacy Data Visualization'], - translations.certification.title[ - 'Legacy Information Security and Quality Assurance' - ] + translations.certification.title['legacy-front-end'], + translations.certification.title['legacy-back-end'], + translations.certification.title['legacy-data-visualization'], + translations.certification.title['information-security-and-quality-assurance'] ]; test.describe('Settings - Certified User', () => {