From 168830aa23d35f3c0974706aca8d5fb6448ffa42 Mon Sep 17 00:00:00 2001 From: dwrik <67830799+dwrik@users.noreply.github.com> Date: Wed, 24 Jul 2024 21:48:13 +0530 Subject: [PATCH] fix(curriculum): tests incorrectly checking for `+ 1` (#55588) Co-authored-by: Krzysztof G. <60067306+gikf@users.noreply.github.com> --- .../62a8e4dc6a60f85bf256a0cb.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e4dc6a60f85bf256a0cb.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e4dc6a60f85bf256a0cb.md index 6225b405f50..fb8fb0c0de1 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e4dc6a60f85bf256a0cb.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/learn-basic-javascript-by-building-a-role-playing-game/62a8e4dc6a60f85bf256a0cb.md @@ -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--