fix: remove comments before tests (#35906)
This commit is contained in:
@ -23,9 +23,9 @@ Refactor the function <code>setGear</code> inside the object <code>bicycle</code
|
||||
```yml
|
||||
tests:
|
||||
- text: Traditional function expression should not be used.
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/function/));
|
||||
testString: getUserInput => assert(!removeJSComments(code).match(/function/));
|
||||
- text: <code>setGear</code> should be a declarative function.
|
||||
testString: getUserInput => assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\s*\(.+\)\s*\{/));
|
||||
testString: assert(typeof bicycle.setGear === 'function' && code.match(/setGear\s*\(.+\)\s*\{/));
|
||||
- text: <code>bicycle.setGear(48)</code> should change the <code>gear</code> value to 48.
|
||||
testString: assert((new bicycle.setGear(48)).gear === 48);
|
||||
|
||||
@ -53,6 +53,15 @@ console.log(bicycle.gear);
|
||||
|
||||
</div>
|
||||
|
||||
### After Test
|
||||
<div id='js-teardown'>
|
||||
|
||||
```js
|
||||
const removeJSComments = str => str.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm, '');
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
|
Reference in New Issue
Block a user