From e5adb9444fe09676bb6d679036471179ff58ffcf Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 6 Jun 2024 02:40:08 -0400 Subject: [PATCH] fix(curriculum): limit hardcoding roman numerals (#54819) --- .../build-a-roman-numeral-converter.md | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-roman-numeral-converter-project/build-a-roman-numeral-converter.md b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-roman-numeral-converter-project/build-a-roman-numeral-converter.md index f6819c4ab89..19a9b0509b4 100644 --- a/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-roman-numeral-converter-project/build-a-roman-numeral-converter.md +++ b/curriculum/challenges/english/15-javascript-algorithms-and-data-structures-22/build-a-roman-numeral-converter-project/build-a-roman-numeral-converter.md @@ -170,6 +170,34 @@ convertBtnEl.click(); assert.strictEqual(outputEl.innerText.trim(), 'MMMCMXCIX'); ``` +When the `#number` element contains a random negative number and the `#convert-btn` element is clicked, the `#output` element should contain the text `"Please enter a number greater than or equal to 1"`. + +```js +const numberInputEl = document.getElementById('number'); +const convertBtnEl = document.getElementById('convert-btn'); +const outputEl = document.getElementById('output'); + +const randomNegativeNumber = Math.floor(Math.random() * -4000) - 2; + +numberInputEl.value = randomNegativeNumber; +convertBtnEl.click(); +assert.strictEqual(outputEl.innerText.trim().replace(/[.,?!]+$/g, '').toLowerCase(), 'please enter a number greater than or equal to 1'); +``` + +When the `#number` element contains a number greater than 4000 and the `#convert-btn` element is clicked, the `#output` element should contain the text `"Please enter a number less than or equal to 3999"`. + +```js +const numberInputEl = document.getElementById('number'); +const convertBtnEl = document.getElementById('convert-btn'); +const outputEl = document.getElementById('output'); + +const randomBigNumber = Math.floor(Math.random() * (1000000)) + 4000; + +numberInputEl.value = randomBigNumber; +convertBtnEl.click(); +assert.strictEqual(outputEl.innerText.trim().replace(/[.,?!]+$/g, '').toLowerCase(), 'please enter a number less than or equal to 3999'); +``` + # --seed-- ## --seed-contents--