fix(curriculum): tests incorrectly checking for + 1 (#55588)

Co-authored-by: Krzysztof G. <60067306+gikf@users.noreply.github.com>
This commit is contained in:
dwrik
2024-07-24 21:48:13 +05:30
committed by GitHub
parent 25b6fb50a1
commit 168830aa23
@@ -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--