fix(learn): update tests to allow more valid solutions (#39054)
* fix(curriculum): updated tests: fixed #39049 It won't pass something like this now: const myConcat = () => {}; console.log(3); * fix: add suggested change Co-authored-by: moT01 <20648924+moT01@users.noreply.github.com>
This commit is contained in:
@ -45,10 +45,10 @@ tests:
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/var/g));
|
||||
- text: <code>myConcat</code> should be a constant variable (by using <code>const</code>).
|
||||
testString: getUserInput => assert(getUserInput('index').match(/const\s+myConcat/g));
|
||||
- text: <code>myConcat</code> should be a function.
|
||||
testString: assert(typeof myConcat === 'function');
|
||||
- text: <code>myConcat</code> should be an arrow function with two parameters
|
||||
testString: assert(/myConcat=\(\w+,\w+\)=>/.test(code.replace(/\s/g, '')) && typeof myConcat === 'function');
|
||||
- text: <code>myConcat()</code> should return <code>[1, 2, 3, 4, 5]</code>.
|
||||
testString: assert(() => { const a = myConcat([1], [2]); return a[0] == 1 && a[1] == 2; });
|
||||
testString: assert.deepEqual(myConcat([1, 2], [3, 4, 5]), [1, 2, 3, 4, 5]);
|
||||
- text: <code>function</code> keyword should not be used.
|
||||
testString: getUserInput => assert(!getUserInput('index').match(/function/g));
|
||||
|
||||
|
Reference in New Issue
Block a user