chore(curriculum): remove concatenation asserts in Trivia Bot lab (#60450)

Co-authored-by: Ilenia M <nethleen@gmail.com>
This commit is contained in:
Supravisor
2025-09-03 11:36:33 +12:00
committed by GitHub
parent 24856ae868
commit 692fcec514

View File

@@ -13,9 +13,9 @@ dashedName: lab-javascript-trivia-bot
1. You should log `"Hello! I'm your coding fun fact guide!"` to the console as a greeting message to the user.
1. You should create three variables: `botName`, `botLocation`, and `favoriteLanguage`, that store the bot's name, where it's from, and its favorite coding language, respectively.
1. You should use string concatenation to log `"My name is (botName) and I live on (botLocation)."` to the console.
1. You should use string concatenation to log `"My favorite programming language is (favoriteLanguage)."` to the console.
1. You should use `let` to create a `codingFact` variable and assign it a string that is a fun fact about your bot's favorite coding language and uses string concatenation to include the use of the `favoriteLanguage` variable.
1. You should log `"My name is (botName) and I live on (botLocation)."` to the console.
1. You should log `"My favorite programming language is (favoriteLanguage)."` to the console.
1. You should use `let` to create a `codingFact` variable and assign it a string that is a fun fact about your bot's favorite coding language and include the use of the `favoriteLanguage` variable.
1. You should log the `codingFact` to the console.
1. You should reassign the `codingFact` variable to a new fact about the bot's favorite language using the `favoriteLanguage` variable again.
1. You should log the `codingFact` to the console again.
@@ -74,20 +74,18 @@ Your `favoriteLanguage` variable should be a string.
assert.isString(favoriteLanguage);
```
You should log to the console `"My name is (botName) and I live on (botLocation)."` using concatenation to add the variables to the string.
You should log to the console `"My name is (botName) and I live on (botLocation)."` and add the variables to the string.
```js
const codeWithoutComments = __helpers.removeJSComments(code);
assert.equal(getLogs()[1], `My name is ${botName} and I live on ${botLocation}.`)
assert.match(codeWithoutComments, /is ("|')\s*\+\s*botName\s*\+\s*("|') and I live on \2\s*\+\s*botLocation\s*\+\s*('|")\./)
```
You should log to the console `"My favorite programming language is (favoriteLanguage)."` using concatenation to add the variable to the string.
You should log to the console `"My favorite programming language is (favoriteLanguage)."` and add the variable to the string.
```js
const codeWithoutComments = __helpers.removeJSComments(code);
assert.equal(getLogs()[2], `My favorite programming language is ${favoriteLanguage}.`)
assert.match(codeWithoutComments, /language is ('|")\s*\+\s*favoriteLanguage\s*\+\s*('|")\./);
```
You should use `let` to declare a new variable `codingFact`.
@@ -97,12 +95,12 @@ const codeWithoutComments = __helpers.removeJSComments(code);
assert.match(code, /let\s+codingFact/)
```
You should give `codingFact` a value that includes `favoriteLanguage` using concatenation.
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);
@@ -135,21 +133,17 @@ 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\s*\+\s*(("|')?.+?\2?))/g);
assert.include(getLogs()[5], favoriteLanguage);
assert.notEqual(getLogs()[5], getLogs()[4]);
assert.equal(getLogs()[5], codingFact);
assert.lengthOf(loggingCodingFacts, 3);
assert.exists(third);
assert.isNotEmpty(codingFact);
```
You should log to the console `"It was fun sharing these facts with you. Goodbye! - (botName) from (botLocation)."` using concatenation to add the values of the variables.
You should log to the console `"It was fun sharing these facts with you. Goodbye! - (botName) from (botLocation)."` and add the values of the variables.
```js
const codeWithoutComments = __helpers.removeJSComments(code);
assert.equal(getLogs()[6], `It was fun sharing these facts with you. Goodbye! - ${botName} from ${botLocation}.`);
assert.match(codeWithoutComments, /\. Goodbye! - ("|')\s*\+\s*botName\s*\+\s*('|") from \2\s*\+\s*botLocation\s*\+\s*("|')\./)
```
# --seed--