fix(curriculum): changed test text to use should for JavaScript Algorithms and Data Structures (#37761)

* fix: corrected typo

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
Randell Dawson
2019-11-27 02:57:38 -08:00
committed by Oliver Eyton-Williams
parent 9886cf7ca2
commit 2c15bcbb43
62 changed files with 155 additions and 155 deletions

View File

@ -47,11 +47,11 @@ Use an iterator method (any kind of loop) to get the desired output.
tests:
- text: <code>resultDisplayArray</code> should be an array containing <code>result failure</code> messages.
testString: assert(typeof makeList(result.failure) === 'object' && resultDisplayArray.length === 3);
- text: <code>resultDisplayArray</code> is the desired output.
- text: <code>resultDisplayArray</code> should be equal to the specified output.
testString: assert(makeList(result.failure).every((v, i) => v === `<li class="text-warning">${result.failure[i]}</li>` || v === `<li class='text-warning'>${result.failure[i]}</li>`));
- text: Template strings and expression interpolation should be used
- text: Template strings and expression interpolation should be used.
testString: getUserInput => assert(getUserInput('index').match(/(`.*\${.*}.*`)/));
- text: An iterator should be used
- text: An iterator should be used.
testString: getUserInput => assert(getUserInput('index').match(/for|map|reduce|forEach|while/));
```

View File

@ -31,7 +31,7 @@ Change the code so that all variables are declared using <code>let</code> or <co
```yml
tests:
- text: <code>var</code> does not exist in your code.
- text: <code>var</code> should not exist in your code.
testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- text: <code>SENTENCE</code> should be a constant variable declared with <code>const</code>.
testString: getUserInput => assert(getUserInput('index').match(/(const SENTENCE)/g));

View File

@ -48,7 +48,7 @@ Update the code so it only uses the <code>let</code> keyword.
```yml
tests:
- text: <code>var</code> does not exist in code.
- text: <code>var</code> should not exist in the code.
testString: getUserInput => assert(!getUserInput('index').match(/var/g));
- text: <code>catName</code> should be <code>Oliver</code>.
testString: assert(catName === "Oliver");

View File

@ -32,11 +32,11 @@ An array is declared as <code>const s = [5, 7, 2]</code>. Change the array to <c
```yml
tests:
- text: Do not replace <code>const</code> keyword.
- text: You should not replace <code>const</code> keyword.
testString: getUserInput => assert(getUserInput('index').match(/const/g));
- text: <code>s</code> should be a constant variable (by using <code>const</code>).
testString: getUserInput => assert(getUserInput('index').match(/const\s+s/g));
- text: Do not change the original array declaration.
- text: You should not change the original array declaration.
testString: getUserInput => assert(getUserInput('index').match(/const\s+s\s*=\s*\[\s*5\s*,\s*7\s*,\s*2\s*\]\s*;?/g));
- text: <code>s</code> should be equal to <code>[2, 5, 7]</code>.
testString: assert.deepEqual(s, [2, 5, 7]);

View File

@ -34,13 +34,13 @@ In this challenge you are going to use <code>Object.freeze</code> to prevent mat
```yml
tests:
- text: Do not replace <code>const</code> keyword.
- text: You should not replace <code>const</code> keyword.
testString: getUserInput => assert(getUserInput('index').match(/const/g));
- text: <code>MATH_CONSTANTS</code> should be a constant variable (by using <code>const</code>).
testString: getUserInput => assert(getUserInput('index').match(/const\s+MATH_CONSTANTS/g));
- text: Do not change original <code>MATH_CONSTANTS</code>.
- text: You should not change original <code>MATH_CONSTANTS</code>.
testString: getUserInput => assert(getUserInput('index').match(/const\s+MATH_CONSTANTS\s+=\s+{\s+PI:\s+3.14\s+};/g));
- text: <code>PI</code> equals <code>3.14</code>.
- text: <code>PI</code> should equal <code>3.14</code>.
testString: assert(PI === 3.14);
```

View File

@ -34,7 +34,7 @@ tests:
testString: assert(increment(5, 2) === 7);
- text: The result of <code>increment(5)</code> should be <code>6</code>.
testString: assert(increment(5) === 6);
- text: Default parameter <code>1</code> was used for <code>value</code>.
- text: A default parameter value of <code>1</code> should be used for <code>value</code>.
testString: assert(code.match(/value\s*=\s*1/g));
```

View File

@ -32,7 +32,7 @@ The code in this file requires the contents of the file: <code>string_functions.
```yml
tests:
- text: Properly uses <code>import * as</code> syntax.
- text: Your code should properly use <code>import * as</code> syntax.
testString: assert(code.match(/import\s*\*\s*as\s+stringFunctions\s+from\s*('|")\.\/string_functions\.js\1/g));
```

View File

@ -40,7 +40,7 @@ tests:
testString: assert(a === 6);
- text: Value of <code>b</code> should be 8, after swapping.
testString: assert(b === 8);
- text: Should use array destructuring to swap a and b.
- text: You should use array destructuring to swap a and b.
testString: assert(/\[\s*(\w)\s*,\s*(\w)\s*\]\s*=\s*\[\s*\2\s*,\s*\1\s*\]/g.test(code));
```

View File

@ -44,7 +44,7 @@ Copy all contents of <code>arr1</code> into another array <code>arr2</code> usin
tests:
- text: <code>arr2</code> should be correct copy of <code>arr1</code>.
testString: assert(arr2.every((v, i) => v === arr1[i]));
- text: <code>...</code> spread operator was used to duplicate <code>arr1</code>.
- text: <code>...</code> spread operator should be used to duplicate <code>arr1</code>.
testString: assert(code.match(/Array\(\s*\.\.\.arr1\s*\)|\[\s*\.\.\.arr1\s*\]/));
- text: <code>arr2</code> should remain unchanged when <code>arr1</code> is changed.
testString: assert((arr1, arr2) => {arr1.push('JUN'); return arr2.length < arr1.length});

View File

@ -40,15 +40,15 @@ Rewrite the <code>myConcat</code> function which appends contents of <code>arr2<
```yml
tests:
- text: User did replace <code>var</code> keyword.
- text: You should replace the <code>var</code> keyword.
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
- text: <code>myConcat</code> should be a function.
testString: assert(typeof myConcat === 'function');
- text: <code>myConcat()</code> returns the correct <code>array</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; });
- text: <code>function</code> keyword was not used.
- text: <code>function</code> keyword should not be used.
testString: getUserInput => assert(!getUserInput('index').match(/function/g));
```