From 66398a930012e0504667988a277e6397095521de Mon Sep 17 00:00:00 2001
From: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
Date: Tue, 30 Apr 2019 17:12:22 -0700
Subject: [PATCH] fix(curriculum): Improved the tests for Find the length of a
String challenge (#35940)
* fix: split tests into two requests
* fix: removed typeof number check
Co-Authored-By: RandellDawson <5313213+RandellDawson@users.noreply.github.com>
* fix: remove unneeded After Test section
---
.../find-the-length-of-a-string.english.md | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.english.md
index 94ab69f38e..f930608b8a 100644
--- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.english.md
+++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/basic-javascript/find-the-length-of-a-string.english.md
@@ -22,10 +22,12 @@ Use the .length
property to count the number of characters in the <
```yml
tests:
+ - text: 'You should not change the variable declarations in the // Setup
section.'
+ testString: assert(code.match(/var lastNameLength = 0;/) && code.match(/var lastName = "Lovelace";/));
- text: lastNameLength
should be equal to eight.
- testString: assert((function(){if(typeof lastNameLength !== "undefined" && typeof lastNameLength === "number" && lastNameLength === 8){return true;}else{return false;}})(), 'lastNameLength
should be equal to eight.');
+ testString: assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8);
- text: 'You should be getting the length of lastName
by using .length
like this: lastName.length
.'
- testString: 'assert((function(){if(code.match(/\.length/gi) && code.match(/\.length/gi).length >= 2 && code.match(/var lastNameLength \= 0;/gi) && code.match(/var lastNameLength \= 0;/gi).length >= 1){return true;}else{return false;}})(), ''You should be getting the length of lastName
by using .length
like this: lastName.length
.'');'
+ testString: assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/));
```
@@ -56,16 +58,6 @@ lastNameLength = lastName;
-
-### After Test
-