test: enable tests for steps (#44550)

* fix: handle missing solutions correctly

Rather than creating an [[]] the parser now creates [] which isEmpty().
This makes the test suite check the next challenge for a solution.

In addition, the logic for testing solutions was fixed.

* chore: update snapshots

* test: build new superblock in node.js-tests CI

* test: allow forward slash in superblock slug

* fix: borked tests oops

* test: ignore duplicated projects

* fix: i did not break these shaun did :)

* fix: idIndex is index of id not id

Co-authored-by: Nicholas Carrigan <nhcarrigan@gmail.com>
This commit is contained in:
Oliver Eyton-Williams
2021-12-22 20:18:06 +00:00
committed by GitHub
parent 4be4bf3624
commit 36363f277d
141 changed files with 267 additions and 201 deletions

View File

@ -3,6 +3,13 @@ const findIndex = require('lodash/findIndex');
Joi.objectId = require('joi-objectid')(Joi);
const schema = Joi.objectId();
const duplicatedProjectIds = [
'bd7158d8c442eddfaeb5bd18',
'587d78af367417b2b2512b03',
'587d78af367417b2b2512b04',
'587d78b0367417b2b2512b05',
'bd7158d8c242eddfaeb5bd13'
];
class MongoIds {
constructor() {
@ -12,14 +19,13 @@ class MongoIds {
try {
schema.validate(id);
} catch {
throw new Error(`Expected a valid ObjectId for ${title}, but got ${id}`);
throw Error(`Expected a valid ObjectId for ${title}, but got ${id}`);
}
const idIndex = findIndex(this.knownIds, existing => id === existing);
// TODO: check for the exceptions or remove the warning.
if (idIndex !== -1) {
console.warn(`The id for challenge ${title} appears more than once.
With the exception of some projects this should not happen.
if (idIndex !== -1 && !duplicatedProjectIds.includes(id)) {
throw Error(`The id for challenge ${title} appears more than once.
With the exception of duplicatedProjectIds this should not happen.
`);
}
this.knownIds = [...this.knownIds, id];