Make a comparison in the test more accurately (#35500)
* Update use-arrow-functions-to-write-concise-anonymous-functions.english.md * refactor: fix the assert messages to make them more like all the rest in the curriculum (i.e. using `should`) Co-Authored-By: iliyaZelenko <iliyazelenkog@gmail.com>
This commit is contained in:
committed by
Oliver Eyton-Williams
parent
4c9282d3bf
commit
a326c2cf9a
@ -26,16 +26,16 @@ Rewrite the function assigned to the variable <code>magic</code> which returns a
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: User did replace <code>var</code> keyword.
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace <code>var</code> keyword.');
|
||||
- text: User should replace <code>var</code> keyword.
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/var/g));
|
||||
- text: <code>magic</code> should be a constant variable (by using <code>const</code>).
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+magic/g), '<code>magic</code> should be a constant variable (by using <code>const</code>).');
|
||||
- text: <code>magic</code> is a <code>function</code>.
|
||||
testString: assert(typeof magic === 'function', '<code>magic</code> is a <code>function</code>.');
|
||||
- text: <code>magic()</code> returns correct date.
|
||||
testString: assert(magic().getDate() == new Date().getDate(), '<code>magic()</code> returns correct date.');
|
||||
- text: <code>function</code> keyword was not used.
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/function/g), '<code>function</code> keyword was not used.');
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+magic/g));
|
||||
- text: <code>magic</code> should be a <code>function</code>.
|
||||
testString: assert(typeof magic === 'function');
|
||||
- text: <code>magic()</code> should return correct date.
|
||||
testString: assert(magic().setHours(0,0,0,0) === new Date().setHours(0,0,0,0));
|
||||
- text: <code>function</code> keyword should not be used.
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/function/g));
|
||||
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user