mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-08 21:02:25 -05:00
fix(curriculum): update test case on lunch picker program (#58942)
This commit is contained in:
@@ -360,16 +360,28 @@ try {
|
||||
`showLunchMenu(["Greens", "Corns", "Beans"])` should log `"Menu items: Greens, Corns, Beans"` to the console.
|
||||
|
||||
```js
|
||||
let testLunches = ["Greens", "Corns", "Beans"];
|
||||
const testLunches = ["Greens", "Corns", "Beans"];
|
||||
const tempArr = [];
|
||||
const temp = console.log;
|
||||
try {
|
||||
console.log = obj => tempArr.push(obj);
|
||||
showLunchMenu(testLunches);
|
||||
assert.strictEqual(tempArr[0], "Menu items: Greens, Corns, Beans");
|
||||
testLunches = ["Pizza", "Burger", "Fries"]
|
||||
assert.strictEqual(tempArr[0], `Menu items: ${testLunches.join(", ")}`);
|
||||
} finally {
|
||||
console.log = temp;
|
||||
}
|
||||
```
|
||||
|
||||
`showLunchMenu(["Pizza", "Burger", "Fries", "Salad"])` should log `"Menu items: Pizza, Burger, Fries, Salad"` to the console.
|
||||
|
||||
```js
|
||||
const testLunches = ["Pizza", "Burger", "Fries", "Salad"];
|
||||
const tempArr = [];
|
||||
const temp = console.log;
|
||||
try {
|
||||
console.log = obj => tempArr.push(obj);
|
||||
showLunchMenu(testLunches);
|
||||
assert.strictEqual(tempArr[1], "Menu items: Pizza, Burger, Fries");
|
||||
assert.strictEqual(tempArr[0], `Menu items: ${testLunches.join(", ")}`);
|
||||
} finally {
|
||||
console.log = temp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user