fix(curriculum): make concatenation optional (#62232)

This commit is contained in:
Supravisor
2025-09-23 03:17:40 +12:00
committed by GitHub
parent 62c47f46e5
commit 8d791e0718
@@ -100,10 +100,11 @@ You should give `codingFact` a value that includes `favoriteLanguage`.
```js
const codeWithoutComments = __helpers.removeJSComments(code);
assert.match(code, /let\s+codingFact/);
assert.match(code, /codingFact\s*=\s*(("|'|`)?.+?\1?\s*\+\s*|favoriteLanguage\s*\+\s*(("|'|`)?.+?\3?))/);
assert.match(code, /codingFact\s*=\s*(("|'|`)?.+?\1?\s*\+?\s*|favoriteLanguage\s*\+\s*(("|'|`)?.+?\3?))/);
assert.exists(codingFact);
assert.isNotEmpty(codingFact);
assert.include(String(codingFact), favoriteLanguage);
assert.include(getLogs()[3], favoriteLanguage);
```
You should log `codingFact` to the console.
@@ -120,7 +121,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\s*\+\s*(("|')?.+?\2?))/g);
const [first, second, third] = codeWithoutComments.match(/(let )?\s*codingFact\s*=\s*(("|')?.+?\2?\s*\+?\s*|favoriteLanguage\s*\+\s*(("|')?.+?\2?))/g);
assert.include(getLogs()[4], favoriteLanguage);
assert.notEqual(getLogs()[4], getLogs()[3]);
assert.isAtLeast(loggingCodingFacts.length, 2);