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
This commit is contained in:
Randell Dawson
2019-04-30 17:12:22 -07:00
committed by Tom
parent e3529a8449
commit 66398a9300

View File

@ -22,10 +22,12 @@ Use the <code>.length</code> property to count the number of characters in the <
```yml
tests:
- text: 'You should not change the variable declarations in the <code>// Setup</code> section.'
testString: assert(code.match(/var lastNameLength = 0;/) && code.match(/var lastName = "Lovelace";/));
- text: <code>lastNameLength</code> should be equal to eight.
testString: assert((function(){if(typeof lastNameLength !== "undefined" && typeof lastNameLength === "number" && lastNameLength === 8){return true;}else{return false;}})(), '<code>lastNameLength</code> should be equal to eight.');
testString: assert(typeof lastNameLength !== 'undefined' && lastNameLength === 8);
- text: 'You should be getting the length of <code>lastName</code> by using <code>.length</code> like this: <code>lastName.length</code>.'
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 <code>lastName</code> by using <code>.length</code> like this: <code>lastName.length</code>.'');'
testString: assert(code.match(/=\s*lastName\.length/g) && !code.match(/lastName\s*=\s*8/));
```
@ -56,16 +58,6 @@ lastNameLength = lastName;
</div>
### After Test
<div id='js-teardown'>
```js
if(typeof lastNameLength !== "undefined"){(function(){return lastNameLength;})();}
```
</div>
</section>
## Solution