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:
Vikas KM
2019-03-24 00:57:42 +05:30
committed by Manish Giri
parent 4bc1d74f2a
commit 9e36ff87bb

View File

@ -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>