refactor: remove release code (#57957)

This commit is contained in:
Oliver Eyton-Williams
2025-01-06 17:44:57 +01:00
committed by GitHub
parent be6736f5df
commit d68cbdb2c4
16 changed files with 35 additions and 177 deletions
+2 -18
View File
@@ -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', () => {
+3 -11
View File
@@ -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 =>