refactor: drop superorder from metas (#44422)

* refactor: create superOrder from superblock

* chore: drop superOrders from meta

* fix: return null for 'certifications'

* fix: only set superOrder if it is needed

* fix(tests): remove filter from order tests

* test: use getSuperOrder, since superOrder has gone

* test: ignore certificates

* fix: getSuperOrder throw for 'certifications'

* test: remove certificate special case

It wasn't necessary, anyway (it had never been working because I put
certificate not certification)

Co-authored-by: Nicholas Carrigan <nhcarrigan@gmail.com>
This commit is contained in:
Oliver Eyton-Williams
2021-12-14 17:16:23 +01:00
committed by GitHub
parent d4f490419f
commit 1642c631de
74 changed files with 81 additions and 84 deletions

View File

@ -16,3 +16,32 @@ exports.testedLang = function testedLang() {
throw Error('LOCALE must be set for testing');
}
};
// TODO: migrate to TS and use the SuperBlocks enum from
// config/certification-settings.ts
const superBlockToOrder = {
'responsive-web-design': 0,
'javascript-algorithms-and-data-structures': 1,
'front-end-development-libraries': 2,
'data-visualization': 3,
'relational-databases': 4,
'back-end-development-and-apis': 5,
'quality-assurance': 6,
'scientific-computing-with-python': 7,
'data-analysis-with-python': 8,
'information-security': 9,
'machine-learning-with-python': 10,
'coding-interview-prep': 11
};
function getSuperOrder(superblock, { isLegacy } = { isLegacy: false }) {
if (typeof superblock !== 'string')
throw Error('superblock must be a string');
const order = superBlockToOrder[superblock];
if (typeof order === 'undefined')
throw Error(`${superblock} is not a valid superblock`);
return isLegacy ? order + 12 : order;
}
exports.getSuperOrder = getSuperOrder;