mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
refactor: use cert-slugs where possible (#57505)
This commit is contained in:
committed by
GitHub
parent
cf18718fcc
commit
1690afeb95
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user