mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat(client): move FSD superblock into Next superblock stage (#57349)
This commit is contained in:
committed by
GitHub
parent
02c3c7913a
commit
383cf7f978
@@ -20,10 +20,11 @@ describe('superBlockOrder', () => {
|
||||
});
|
||||
|
||||
describe('generateSuperBlockList', () => {
|
||||
it('should return an array of SuperBlocks object with New and Upcoming when { showNewCurriculum: true, showUpcomingChanges: true }', () => {
|
||||
it('should return an array of SuperBlocks object with all elements when if all configs are true', () => {
|
||||
const result = generateSuperBlockList({
|
||||
showNewCurriculum: true,
|
||||
showUpcomingChanges: true
|
||||
showUpcomingChanges: true,
|
||||
showNextCurriculum: true
|
||||
});
|
||||
expect(result).toHaveLength(Object.values(superBlockStages).flat().length);
|
||||
});
|
||||
@@ -31,13 +32,27 @@ describe('generateSuperBlockList', () => {
|
||||
it('should return an array of SuperBlocks without New and Upcoming when { showNewCurriculum: false, showUpcomingChanges: false }', () => {
|
||||
const result = generateSuperBlockList({
|
||||
showNewCurriculum: false,
|
||||
showUpcomingChanges: false
|
||||
showUpcomingChanges: false,
|
||||
showNextCurriculum: true
|
||||
});
|
||||
const tempSuperBlockMap = { ...superBlockStages };
|
||||
tempSuperBlockMap[SuperBlockStage.New] = [];
|
||||
tempSuperBlockMap[SuperBlockStage.Upcoming] = [];
|
||||
expect(result).toHaveLength(Object.values(tempSuperBlockMap).flat().length);
|
||||
});
|
||||
|
||||
it('should exclude the Next SuperBlocks when { showNextCurriculum: false }', () => {
|
||||
const result = generateSuperBlockList({
|
||||
showNewCurriculum: false,
|
||||
showUpcomingChanges: false,
|
||||
showNextCurriculum: false
|
||||
});
|
||||
const tempSuperBlockMap = { ...superBlockStages };
|
||||
tempSuperBlockMap[SuperBlockStage.New] = [];
|
||||
tempSuperBlockMap[SuperBlockStage.Upcoming] = [];
|
||||
tempSuperBlockMap[SuperBlockStage.Next] = [];
|
||||
expect(result).toHaveLength(Object.values(tempSuperBlockMap).flat().length);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Immutability of superBlockOrder, notAuditedSuperBlocks, and flatSuperBlockMap', () => {
|
||||
|
||||
@@ -35,6 +35,10 @@ export enum SuperBlocks {
|
||||
*
|
||||
* SuperBlockStages.Upcoming = SHOW_UPCOMING_CHANGES === 'true'
|
||||
* 'Upcoming' is for development -> not shown on stag or prod anywhere
|
||||
*
|
||||
* SuperBlockStages.Next = deployed, but only shown if the Growthbook feature
|
||||
* is enabled.
|
||||
*
|
||||
*/
|
||||
export enum SuperBlockStage {
|
||||
Core,
|
||||
@@ -43,11 +47,13 @@ export enum SuperBlockStage {
|
||||
Extra,
|
||||
Legacy,
|
||||
New,
|
||||
Upcoming
|
||||
Upcoming,
|
||||
Next
|
||||
}
|
||||
|
||||
const defaultStageOrder = [
|
||||
SuperBlockStage.Core,
|
||||
SuperBlockStage.Next,
|
||||
SuperBlockStage.English,
|
||||
SuperBlockStage.Professional,
|
||||
SuperBlockStage.Extra,
|
||||
@@ -56,9 +62,12 @@ const defaultStageOrder = [
|
||||
|
||||
export function getStageOrder({
|
||||
showNewCurriculum,
|
||||
showUpcomingChanges
|
||||
showUpcomingChanges,
|
||||
showNextCurriculum
|
||||
}: Config): SuperBlockStage[] {
|
||||
const stageOrder = [...defaultStageOrder];
|
||||
const stageOrder = showNextCurriculum
|
||||
? [...defaultStageOrder]
|
||||
: [...defaultStageOrder.filter(stage => stage !== SuperBlockStage.Next)];
|
||||
|
||||
if (showNewCurriculum) stageOrder.push(SuperBlockStage.New);
|
||||
if (showUpcomingChanges) stageOrder.push(SuperBlockStage.Upcoming);
|
||||
@@ -85,6 +94,7 @@ export const superBlockStages: StageMap = {
|
||||
SuperBlocks.MachineLearningPy,
|
||||
SuperBlocks.CollegeAlgebraPy
|
||||
],
|
||||
[SuperBlockStage.Next]: [SuperBlocks.FullStackDeveloper],
|
||||
[SuperBlockStage.English]: [SuperBlocks.A2English],
|
||||
[SuperBlockStage.Professional]: [SuperBlocks.FoundationalCSharp],
|
||||
[SuperBlockStage.Extra]: [
|
||||
@@ -99,10 +109,7 @@ export const superBlockStages: StageMap = {
|
||||
SuperBlocks.PythonForEverybody
|
||||
],
|
||||
[SuperBlockStage.New]: [],
|
||||
[SuperBlockStage.Upcoming]: [
|
||||
SuperBlocks.B1English,
|
||||
SuperBlocks.FullStackDeveloper
|
||||
]
|
||||
[SuperBlockStage.Upcoming]: [SuperBlocks.B1English]
|
||||
};
|
||||
|
||||
Object.freeze(superBlockStages);
|
||||
@@ -246,6 +253,7 @@ Object.freeze(notAuditedSuperBlocks);
|
||||
type Config = {
|
||||
showNewCurriculum: boolean;
|
||||
showUpcomingChanges: boolean;
|
||||
showNextCurriculum: boolean;
|
||||
};
|
||||
|
||||
export function generateSuperBlockList(config: Config): SuperBlocks[] {
|
||||
@@ -266,7 +274,8 @@ export function getAuditedSuperBlocks({
|
||||
// To find the audited superblocks, we need to start with all superblocks.
|
||||
const flatSuperBlockMap = generateSuperBlockList({
|
||||
showNewCurriculum: true,
|
||||
showUpcomingChanges: true
|
||||
showUpcomingChanges: true,
|
||||
showNextCurriculum: true
|
||||
});
|
||||
const auditedSuperBlocks = flatSuperBlockMap.filter(
|
||||
superBlock =>
|
||||
|
||||
Reference in New Issue
Block a user