Skip to content

Commit

Permalink
fix(curriculum): tests incorrectly checking for + 1 (freeCodeCamp#5…
Browse files Browse the repository at this point in the history
…5588)

Co-authored-by: Krzysztof G. <[email protected]>
  • Loading branch information
dwrik and gikf authored Jul 24, 2024
1 parent 25b6fb5 commit 168830a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ assert.match(attack.toString(), /Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s
You should add `1` to the result of `Math.floor()`.

```js
assert.match(attack.toString(), /Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp(?:\s*\+\s*1)?\s*\)(?:\s*\+ 1)?/);
assert.match(attack.toString(), /Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*(\+\s*1\s*\)|\)\s*\+\s*1)/);
```

You should add the result of `Math.floor(Math.random() * xp) + 1` to the result of `weapons[currentWeapon].power`.
You should add the result of `Math.floor(Math.random() * xp) + 1` to the result of `weapons[currentWeaponIndex].power`.

```js
assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\s*\[\s*currentWeaponIndex\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp(?:\s*\+\s*1)?\s*\)(?:\s*\+ 1)?/);
assert.match(attack.toString(), /monsterHealth\s*-=\s*weapons\s*\[\s*currentWeaponIndex\s*\]\s*\.power\s*\+\s*Math\.floor\(\s*Math\.random\(\s*\)\s*\*\s*xp\s*(\+\s*1\s*\)|\)\s*\+\s*1)/);
```

# --seed--
Expand Down

0 comments on commit 168830a

Please sign in to comment.