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:
Ishu Singhal
2020-09-03 19:58:35 +05:30
committed by GitHub
parent 6ce2db7bb2
commit 56469d1c5c

View File

@ -45,10 +45,10 @@ tests:
testString: getUserInput => assert(!getUserInput('index').match(/var/g)); testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- text: <code>myConcat</code> should be a constant variable (by using <code>const</code>). - text: <code>myConcat</code> should be a constant variable (by using <code>const</code>).
testString: getUserInput => assert(getUserInput('index').match(/const\s+myConcat/g)); testString: getUserInput => assert(getUserInput('index').match(/const\s+myConcat/g));
- text: <code>myConcat</code> should be a function. - text: <code>myConcat</code> should be an arrow function with two parameters
testString: assert(typeof myConcat === 'function'); 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>. - 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. - text: <code>function</code> keyword should not be used.
testString: getUserInput => assert(!getUserInput('index').match(/function/g)); testString: getUserInput => assert(!getUserInput('index').match(/function/g));