Skip to content

Commit 8c1610a

Browse files
moT01huyenltnguyen
andauthored
fix(mobile): remove a2 spanish superblock (freeCodeCamp#60440)
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
1 parent 1f71111 commit 8c1610a

4 files changed

Lines changed: 33 additions & 25 deletions

tools/scripts/build/build-external-curricula-data-v1.test.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import fs, { readFileSync } from 'fs';
33

44
import readdirp from 'readdirp';
55

6-
import { SuperBlocks } from '../../../shared/config/curriculum';
6+
import {
7+
SuperBlocks,
8+
SuperBlockStage,
9+
superBlockStages
10+
} from '../../../shared/config/curriculum';
711
import {
812
superblockSchemaValidator,
913
availableSuperBlocksValidator
@@ -133,7 +137,14 @@ ${result.error.message}`);
133137
({ dashedName }) => dashedName
134138
);
135139

136-
const publicSuperBlockNames = Object.values(SuperBlocks);
140+
const publicSuperBlockNames = Object.entries(superBlockStages)
141+
.filter(([key]) => {
142+
const stage = Number(key) as SuperBlockStage;
143+
return (
144+
stage !== SuperBlockStage.Next && stage !== SuperBlockStage.Upcoming
145+
);
146+
})
147+
.flatMap(([, superBlocks]) => superBlocks);
137148

138149
expect(dashedNames).toEqual(expect.arrayContaining(publicSuperBlockNames));
139150
expect(Object.keys(orderedSuperBlockInfo)).toHaveLength(

tools/scripts/build/build-external-curricula-data-v1.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export const orderedSuperBlockInfo = [
4444
{ dashedName: SuperBlocks.CollegeAlgebraPy, public: true },
4545
{ dashedName: SuperBlocks.A2English, public: true },
4646
{ dashedName: SuperBlocks.B1English, public: true },
47-
{ dashedName: SuperBlocks.A2Spanish, public: true },
4847
{ dashedName: SuperBlocks.TheOdinProject, public: true },
4948
{ dashedName: SuperBlocks.RespWebDesign, public: true },
5049
{ dashedName: SuperBlocks.PythonForEverybody, public: true },

tools/scripts/build/build-external-curricula-data-v2.test.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import readdirp from 'readdirp';
55

66
import {
77
chapterBasedSuperBlocks,
8-
SuperBlocks
8+
SuperBlocks,
9+
SuperBlockStage,
10+
superBlockStages
911
} from '../../../shared/config/curriculum';
1012
import {
1113
superblockSchemaValidator,
@@ -201,24 +203,25 @@ ${result.error.message}`);
201203
});
202204

203205
test('All public SuperBlocks should be present in the SuperBlock object', () => {
204-
const publicSuperBlockNames = Object.values(SuperBlocks);
205-
206-
const superBlockDashedNames = Object.keys(orderedSuperBlockInfo).reduce(
207-
(acc, superBlockStage) => {
208-
const dashedNames = orderedSuperBlockInfo[superBlockStage].map(
209-
superBlock => superBlock.dashedName
210-
);
211-
acc.push(...dashedNames);
212-
213-
return acc;
214-
},
215-
[] as SuperBlocks[]
206+
const stages = Object.keys(orderedSuperBlockInfo).map(
207+
key => Number(key) as SuperBlockStage
216208
);
217209

218-
expect(superBlockDashedNames).toEqual(
219-
expect.arrayContaining(publicSuperBlockNames)
220-
);
221-
expect(superBlockDashedNames).toHaveLength(publicSuperBlockNames.length);
210+
expect(stages).not.toContain(SuperBlockStage.Next);
211+
expect(stages).not.toContain(SuperBlockStage.Upcoming);
212+
213+
for (const stage of stages) {
214+
const superBlockDashedNames = orderedSuperBlockInfo[stage].map(
215+
superBlock => superBlock.dashedName
216+
);
217+
218+
expect(superBlockDashedNames).toEqual(
219+
expect.arrayContaining(superBlockStages[stage])
220+
);
221+
expect(superBlockDashedNames).toHaveLength(
222+
superBlockStages[stage].length
223+
);
224+
}
222225
});
223226

224227
test('challenge files should be created and in the correct directory', () => {

tools/scripts/build/build-external-curricula-data-v2.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,6 @@ export const orderedSuperBlockInfo: Record<
103103
dashedName: SuperBlocks.B1English,
104104
public: true,
105105
title: intros[SuperBlocks.B1English].title
106-
},
107-
{
108-
dashedName: SuperBlocks.A2Spanish,
109-
public: true,
110-
title: intros[SuperBlocks.A2Spanish].title
111106
}
112107
],
113108

0 commit comments

Comments
 (0)