mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): fix regex issues and improve trivia-bot test flexibility (#58515)
This commit is contained in:
+4
-4
@@ -79,8 +79,8 @@ You should give `codingFact` a value that includes `favoriteLanguage` using con
|
||||
|
||||
```js
|
||||
const codeWithoutComments = __helpers.removeJSComments(code);
|
||||
const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*("|')?.+?\2?\s*\+\s*favoriteLanguage/g)
|
||||
assert.match(code, /let\scodingFact\s*=\s*("|')?.+?\1?\s*\+\s*favoriteLanguage/)
|
||||
const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*(("|')?.+?\2?\s*\+\s*|favoriteLanguage\s*\+\s*(("|')?.+?\2?))/g);
|
||||
assert.match(code, /let\scodingFact\s*=\s*(("|')?.+?\1?\s*\+\s*|favoriteLanguage\s*\+\s*(("|')?.+?\3?))/);
|
||||
assert.include(first, 'let');
|
||||
assert.exists(first);
|
||||
assert.isNotEmpty(codingFact);
|
||||
@@ -100,7 +100,7 @@ You should assign a new value to `codingFact` that also contains `favoriteLangua
|
||||
```js
|
||||
const codeWithoutComments = __helpers.removeJSComments(code);
|
||||
const loggingCodingFacts = codeWithoutComments.match(/console\.log\(\s*codingFact\s*\)/g)
|
||||
const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*("|')?.+?\2?\s*\+\s*favoriteLanguage/g)
|
||||
const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*(("|')?.+?\2?\s*\+\s*|favoriteLanguage\s*\+\s*(("|')?.+?\2?))/g);
|
||||
assert.include(output[4], favoriteLanguage);
|
||||
assert.notEqual(output[4], output[3]);
|
||||
assert.isAtLeast(loggingCodingFacts.length, 2);
|
||||
@@ -113,7 +113,7 @@ You should assign a value to `codingFact` for the third time that also contains
|
||||
```js
|
||||
const codeWithoutComments = __helpers.removeJSComments(code);
|
||||
const loggingCodingFacts = codeWithoutComments.match(/console\.log\(\s*codingFact\s*\)/g)
|
||||
const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*("|')?.+?\2?\s*\+\s*favoriteLanguage/g)
|
||||
const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*(("|')?.+?\2?\s*\+\s*|favoriteLanguage\s*\+\s*(("|')?.+?\2?))/g);
|
||||
assert.include(output[5], favoriteLanguage);
|
||||
assert.notEqual(output[5], output[4]);
|
||||
assert.equal(output[5], codingFact);
|
||||
|
||||
Reference in New Issue
Block a user