mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-29 09:01:04 -05:00
fix: use 0 based index for FSD (#58927)
This commit is contained in:
committed by
GitHub
parent
32eedb35e0
commit
e0fc4fa7aa
@@ -139,7 +139,7 @@ function getBlockOrder(blockName, superBlockStructure) {
|
||||
`The block "${blockName}" does not appear in the superblock structure.`
|
||||
);
|
||||
|
||||
return index + 1;
|
||||
return index;
|
||||
}
|
||||
exports.createSuperOrder = createSuperOrder;
|
||||
exports.getSuperOrder = getSuperOrder;
|
||||
|
||||
@@ -250,11 +250,11 @@ describe('getBlockOrder', () => {
|
||||
it('returns the correct order when the chapter only contains one module', () => {
|
||||
expect(
|
||||
getBlockOrder('welcome-to-freecodecamp', mockSuperBlockStructure)
|
||||
).toBe(1);
|
||||
).toBe(0);
|
||||
});
|
||||
|
||||
it('returns the correct order when the chapter contains multiple modules', () => {
|
||||
expect(getBlockOrder('block-one-m2', mockSuperBlockStructure)).toBe(4);
|
||||
expect(getBlockOrder('block-one-m2', mockSuperBlockStructure)).toBe(3);
|
||||
});
|
||||
|
||||
it('throws if a block does not exist', () => {
|
||||
|
||||
Reference in New Issue
Block a user