From eca650dc699aaaa8846b64e9d1d5d642562e97eb Mon Sep 17 00:00:00 2001 From: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Date: Wed, 6 Jul 2022 22:57:18 -0600 Subject: [PATCH] fix: add test to validate result format has space between count value and text - Counting Cards challenge (#46782) fix: add test to validate result format --- .../basic-javascript/counting-cards.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md index 0ee812b5a23..13b81e676c5 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/counting-cards.md @@ -26,6 +26,40 @@ Do NOT include quotes (single or double) in the output. # --hints-- +Your function should return a value for count and the text (`Bet` or `Hold`) with one space character between them. + +```js +assert(// + (function () { + count = 0; + cc(2); + cc(2); + let out = cc(10); + const hasSpace = /-?\d+ Bet/.test('' + out); + return hasSpace; + })() +); +``` + +Cards Sequence 3, 2, A, 10, K should return the string `-1 Hold` + +```js +assert( + (function () { + count = 0; + cc(3); + cc(2); + cc('A'); + cc(10); + var out = cc('K'); + if (out === '-1 Hold') { + return true; + } + return false; + })() +); +``` + Cards Sequence 2, 3, 4, 5, 6 should return the string `5 Bet` ```js