mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
refactor: remove release code (#57957)
This commit is contained in:
committed by
GitHub
parent
be6736f5df
commit
d68cbdb2c4
@@ -23,8 +23,7 @@ describe('generateSuperBlockList', () => {
|
||||
it('should return an array of SuperBlocks object with all elements when if all configs are true', () => {
|
||||
const result = generateSuperBlockList({
|
||||
showNewCurriculum: true,
|
||||
showUpcomingChanges: true,
|
||||
showNextCurriculum: true
|
||||
showUpcomingChanges: true
|
||||
});
|
||||
expect(result).toHaveLength(Object.values(superBlockStages).flat().length);
|
||||
});
|
||||
@@ -32,28 +31,13 @@ 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,
|
||||
showNextCurriculum: true
|
||||
showUpcomingChanges: false
|
||||
});
|
||||
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] = [];
|
||||
tempSuperBlockMap[SuperBlockStage.NextEnglish] = [];
|
||||
expect(result).toHaveLength(Object.values(tempSuperBlockMap).flat().length);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Immutability of superBlockOrder, notAuditedSuperBlocks, and flatSuperBlockMap', () => {
|
||||
|
||||
@@ -64,15 +64,9 @@ const defaultStageOrder = [
|
||||
|
||||
export function getStageOrder({
|
||||
showNewCurriculum,
|
||||
showUpcomingChanges,
|
||||
showNextCurriculum
|
||||
showUpcomingChanges
|
||||
}: Config): SuperBlockStage[] {
|
||||
const isCurrentStage = (stage: SuperBlockStage) =>
|
||||
!(stage === SuperBlockStage.Next) &&
|
||||
!(stage === SuperBlockStage.NextEnglish);
|
||||
const stageOrder = showNextCurriculum
|
||||
? [...defaultStageOrder]
|
||||
: [...defaultStageOrder.filter(isCurrentStage)];
|
||||
const stageOrder = [...defaultStageOrder];
|
||||
|
||||
if (showNewCurriculum) stageOrder.push(SuperBlockStage.New);
|
||||
if (showUpcomingChanges) stageOrder.push(SuperBlockStage.Upcoming);
|
||||
@@ -259,7 +253,6 @@ Object.freeze(notAuditedSuperBlocks);
|
||||
type Config = {
|
||||
showNewCurriculum: boolean;
|
||||
showUpcomingChanges: boolean;
|
||||
showNextCurriculum: boolean;
|
||||
};
|
||||
|
||||
export function generateSuperBlockList(config: Config): SuperBlocks[] {
|
||||
@@ -280,8 +273,7 @@ export function getAuditedSuperBlocks({
|
||||
// To find the audited superblocks, we need to start with all superblocks.
|
||||
const flatSuperBlockMap = generateSuperBlockList({
|
||||
showNewCurriculum: true,
|
||||
showUpcomingChanges: true,
|
||||
showNextCurriculum: true
|
||||
showUpcomingChanges: true
|
||||
});
|
||||
const auditedSuperBlocks = flatSuperBlockMap.filter(
|
||||
superBlock =>
|
||||
|
||||
Reference in New Issue
Block a user