mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculum): tests incorrectly checking for + 1 (#55588)
Co-authored-by: Krzysztof G. <60067306+gikf@users.noreply.github.com>
This commit is contained in:
+3
-3
@@ -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--
|
||||
|
||||
Reference in New Issue
Block a user