changes to no validate comment (#34810)
* changes to no validate comment Added single line comment check for regex to not validate. * fix: corrected regex * fix: changed + to *
This commit is contained in:
@ -24,13 +24,13 @@ The <code>watchList</code> array holds objects with information on several movie
|
||||
```yml
|
||||
tests:
|
||||
- text: The <code>watchList</code> variable should not change.
|
||||
testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron", 'The <code>watchList</code> variable should not change.');
|
||||
testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron");
|
||||
- text: Your code should not use a <code>for</code> loop.
|
||||
testString: assert(!code.match(/for\s*?\(.+?\)/g), 'Your code should not use a <code>for</code> loop.');
|
||||
testString: assert(!removeJSComments(code).match(/for\s*?\(.*?\)/));
|
||||
- text: Your code should use the <code>map</code> method.
|
||||
testString: assert(code.match(/\.map/g), 'Your code should use the <code>map</code> method.');
|
||||
testString: assert(code.match(/\.map/g));
|
||||
- text: <code>rating</code> should equal <code>[{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}]</code>.
|
||||
testString: assert(JSON.stringify(rating) === JSON.stringify([{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}]), '<code>rating</code> should equal <code>[{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}]</code>.');
|
||||
testString: assert(JSON.stringify(rating) === JSON.stringify([{"title":"Inception","rating":"8.8"},{"title":"Interstellar","rating":"8.6"},{"title":"The Dark Knight","rating":"9.0"},{"title":"Batman Begins","rating":"8.3"},{"title":"Avatar","rating":"7.9"}]));
|
||||
|
||||
```
|
||||
|
||||
@ -170,7 +170,14 @@ console.log(JSON.stringify(rating));
|
||||
|
||||
</div>
|
||||
|
||||
### After Test
|
||||
<div id='js-teardown'>
|
||||
|
||||
```js
|
||||
const removeJSComments = str => str.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
|
Reference in New Issue
Block a user