mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-27 02:01:02 -04:00
fix(curriculum): fix tests for step 43 of shopping cart project (#54631)
This commit is contained in:
@@ -46,14 +46,14 @@ Your `reduce` callback should return the sum of `total` and `item.price`. Use an
|
||||
|
||||
```js
|
||||
const afterCalculateTotal = code.split('calculateTotal')[1];
|
||||
assert.match(afterCalculateTotal, /\(\s*total\s*,\s*item\s*\)\s*=>\s*total\s*\+\s*item\.price/);
|
||||
assert.match(afterCalculateTotal, /\(\s*total\s*,\s*item\s*\)\s*=>\s*(?:total\s*\+\s*item\.price|item\.price\s*\+\s*total)/);
|
||||
```
|
||||
|
||||
Your `reduce` call should have an initial value of `0`.
|
||||
|
||||
```js
|
||||
const afterCalculateTotal = code.split('calculateTotal')[1];
|
||||
assert.match(afterCalculateTotal, /this\s*\.\s*items\s*\.\s*reduce\s*\(\s*\(\s*total\s*,\s*item\s*\)\s*=>\s*total\s*\+\s*item\.price\s*,\s*0\s*\)/);
|
||||
assert.match(afterCalculateTotal, /this\s*\.\s*items\s*\.\s*reduce\s*\(\s*\(\s*total\s*,\s*item\s*\)\s*=>\s*(?:total\s*\+\s*item\.price|item\.price\s*\+\s*total)\s*,\s*0\s*\)/);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
Reference in New Issue
Block a user