fix(curriculum): Remove unnecessary assert message argument from English challenges JavaScript Algorithms and Data Structures - 02 (#36402)
* fix: rm assert msg basic-algorithm-scripting * fix: rm assert msg debugging * fix: rm assert msg es6 * fix: rm assert msg functional-programming
This commit is contained in:
committed by
Oliver Eyton-Williams
parent
c856fe56bd
commit
5bf8527523
@ -30,15 +30,15 @@ Change the <code>nonMutatingPush</code> function so it uses <code>concat</code>
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>concat</code> method.
|
||||
testString: assert(code.match(/\.concat/g), 'Your code should use the <code>concat</code> method.');
|
||||
testString: assert(code.match(/\.concat/g));
|
||||
- text: Your code should not use the <code>push</code> method.
|
||||
testString: assert(!code.match(/\.push/g), 'Your code should not use the <code>push</code> method.');
|
||||
testString: assert(!code.match(/\.push/g));
|
||||
- text: The <code>first</code> array should not change.
|
||||
testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]), 'The <code>first</code> array should not change.');
|
||||
testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]));
|
||||
- text: The <code>second</code> array should not change.
|
||||
testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]), 'The <code>second</code> array should not change.');
|
||||
testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]));
|
||||
- text: <code>nonMutatingPush([1, 2, 3], [4, 5])</code> should return <code>[1, 2, 3, 4, 5]</code>.
|
||||
testString: assert(JSON.stringify(nonMutatingPush([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]), '<code>nonMutatingPush([1, 2, 3], [4, 5])</code> should return <code>[1, 2, 3, 4, 5]</code>.');
|
||||
testString: assert(JSON.stringify(nonMutatingPush([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -26,17 +26,17 @@ The output should not have any spaces
|
||||
```yml
|
||||
tests:
|
||||
- text: The <code>globalTitle</code> variable should not change.
|
||||
testString: assert(globalTitle === "Winter Is Coming", 'The <code>globalTitle</code> variable should not change.');
|
||||
testString: assert(globalTitle === "Winter Is Coming");
|
||||
- text: Your code should not use the <code>replace</code> method for this challenge.
|
||||
testString: assert(!code.match(/\.replace/g), 'Your code should not use the <code>replace</code> method for this challenge.');
|
||||
testString: assert(!code.match(/\.replace/g));
|
||||
- text: <code>urlSlug("Winter Is Coming")</code> should return <code>"winter-is-coming"</code>.
|
||||
testString: assert(urlSlug("Winter Is Coming") === "winter-is-coming", '<code>urlSlug("Winter Is Coming")</code> should return <code>"winter-is-coming"</code>.');
|
||||
testString: assert(urlSlug("Winter Is Coming") === "winter-is-coming");
|
||||
- text: <code>urlSlug(" Winter Is Coming")</code> should return <code>"winter-is-coming"</code>.
|
||||
testString: assert(urlSlug(" Winter Is Coming") === "winter-is-coming", '<code>urlSlug(" Winter Is Coming")</code> should return <code>"winter-is-coming"</code>.');
|
||||
testString: assert(urlSlug(" Winter Is Coming") === "winter-is-coming");
|
||||
- text: <code>urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone")</code> should return <code>"a-mind-needs-books-like-a-sword-needs-a-whetstone"</code>.
|
||||
testString: assert(urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone") === "a-mind-needs-books-like-a-sword-needs-a-whetstone", '<code>urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone")</code> should return <code>"a-mind-needs-books-like-a-sword-needs-a-whetstone"</code>.');
|
||||
testString: assert(urlSlug("A Mind Needs Books Like A Sword Needs A Whetstone") === "a-mind-needs-books-like-a-sword-needs-a-whetstone");
|
||||
- text: <code>urlSlug("Hold The Door")</code> should return <code>"hold-the-door"</code>.
|
||||
testString: assert(urlSlug("Hold The Door") === "hold-the-door", '<code>urlSlug("Hold The Door")</code> should return <code>"hold-the-door"</code>.');
|
||||
testString: assert(urlSlug("Hold The Door") === "hold-the-door");
|
||||
|
||||
```
|
||||
|
||||
|
@ -25,9 +25,9 @@ Fill in the code for the function <code>incrementer</code> so it returns the val
|
||||
```yml
|
||||
tests:
|
||||
- text: Your function <code>incrementer</code> should not change the value of <code>fixedValue</code>.
|
||||
testString: assert(fixedValue === 4, 'Your function <code>incrementer</code> should not change the value of <code>fixedValue</code>.');
|
||||
testString: assert(fixedValue === 4);
|
||||
- text: Your <code>incrementer</code> function should return a value that is one larger than the <code>fixedValue</code> value.
|
||||
testString: assert(newValue === 5, 'Your <code>incrementer</code> function should return a value that is one larger than the <code>fixedValue</code> value.');
|
||||
testString: assert(newValue === 5);
|
||||
|
||||
```
|
||||
|
||||
|
@ -28,17 +28,17 @@ Use the <code>join</code> method (among others) inside the <code>sentensify</cod
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>join</code> method.
|
||||
testString: assert(code.match(/\.join/g), 'Your code should use the <code>join</code> method.');
|
||||
testString: assert(code.match(/\.join/g));
|
||||
- text: Your code should not use the <code>replace</code> method.
|
||||
testString: assert(!code.match(/\.replace/g), 'Your code should not use the <code>replace</code> method.');
|
||||
testString: assert(!code.match(/\.replace/g));
|
||||
- text: <code>sentensify("May-the-force-be-with-you")</code> should return a string.
|
||||
testString: assert(typeof sentensify("May-the-force-be-with-you") === "string", '<code>sentensify("May-the-force-be-with-you")</code> should return a string.');
|
||||
testString: assert(typeof sentensify("May-the-force-be-with-you") === "string");
|
||||
- text: <code>sentensify("May-the-force-be-with-you")</code> should return <code>"May the force be with you"</code>.
|
||||
testString: assert(sentensify("May-the-force-be-with-you") === "May the force be with you", '<code>sentensify("May-the-force-be-with-you")</code> should return <code>"May the force be with you"</code>.');
|
||||
testString: assert(sentensify("May-the-force-be-with-you") === "May the force be with you");
|
||||
- text: <code>sentensify("The.force.is.strong.with.this.one")</code> should return <code>"The force is strong with this one"</code>.
|
||||
testString: assert(sentensify("The.force.is.strong.with.this.one") === "The force is strong with this one", '<code>sentensify("The.force.is.strong.with.this.one")</code> should return <code>"The force is strong with this one"</code>.');
|
||||
testString: assert(sentensify("The.force.is.strong.with.this.one") === "The force is strong with this one");
|
||||
- text: <code>sentensify("There,has,been,an,awakening")</code> should return <code>"There has been an awakening"</code>.
|
||||
testString: assert(sentensify("There,has,been,an,awakening") === "There has been an awakening", '<code>sentensify("There,has,been,an,awakening")</code> should return <code>"There has been an awakening"</code>.');
|
||||
testString: assert(sentensify("There,has,been,an,awakening") === "There has been an awakening");
|
||||
|
||||
```
|
||||
|
||||
|
@ -26,13 +26,13 @@ Use the <code>concat</code> method in the <code>nonMutatingConcat</code> functio
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>concat</code> method.
|
||||
testString: assert(code.match(/\.concat/g), 'Your code should use the <code>concat</code> method.');
|
||||
testString: assert(code.match(/\.concat/g));
|
||||
- text: The <code>first</code> array should not change.
|
||||
testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]), 'The <code>first</code> array should not change.');
|
||||
testString: assert(JSON.stringify(first) === JSON.stringify([1, 2, 3]));
|
||||
- text: The <code>second</code> array should not change.
|
||||
testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]), 'The <code>second</code> array should not change.');
|
||||
testString: assert(JSON.stringify(second) === JSON.stringify([4, 5]));
|
||||
- text: <code>nonMutatingConcat([1, 2, 3], [4, 5])</code> should return <code>[1, 2, 3, 4, 5]</code>.
|
||||
testString: assert(JSON.stringify(nonMutatingConcat([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]), '<code>nonMutatingConcat([1, 2, 3], [4, 5])</code> should return <code>[1, 2, 3, 4, 5]</code>.');
|
||||
testString: assert(JSON.stringify(nonMutatingConcat([1, 2, 3], [4, 5])) === JSON.stringify([1, 2, 3, 4, 5]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -23,9 +23,9 @@ Write your own <code>Array.prototype.myMap()</code>, which should behave exactly
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>new_s</code> should equal <code>[46, 130, 196, 10]</code>.
|
||||
testString: assert(JSON.stringify(new_s) === JSON.stringify([46, 130, 196, 10]), '<code>new_s</code> should equal <code>[46, 130, 196, 10]</code>.');
|
||||
testString: assert(JSON.stringify(new_s) === JSON.stringify([46, 130, 196, 10]));
|
||||
- text: Your code should not use the <code>map</code> method.
|
||||
testString: assert(!code.match(/\.map/g), 'Your code should not use the <code>map</code> method.');
|
||||
testString: assert(!code.match(/\.map/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -21,9 +21,9 @@ Write your own <code>Array.prototype.myFilter()</code>, which should behave exac
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>new_s</code> should equal <code>[23, 65, 5]</code>.
|
||||
testString: assert(JSON.stringify(new_s) === JSON.stringify([23, 65, 5]), '<code>new_s</code> should equal <code>[23, 65, 5]</code>.');
|
||||
testString: assert(JSON.stringify(new_s) === JSON.stringify([23, 65, 5]));
|
||||
- text: Your code should not use the <code>filter</code> method.
|
||||
testString: assert(!code.match(/\.filter/g), 'Your code should not use the <code>filter</code> method.');
|
||||
testString: assert(!code.match(/\.filter/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -61,13 +61,13 @@ Fill in the body of the <code>add</code> function so it uses currying to add par
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>add(10)(20)(30)</code> should return <code>60</code>.
|
||||
testString: assert(add(10)(20)(30) === 60, '<code>add(10)(20)(30)</code> should return <code>60</code>.');
|
||||
testString: assert(add(10)(20)(30) === 60);
|
||||
- text: <code>add(1)(2)(3)</code> should return <code>6</code>.
|
||||
testString: assert(add(1)(2)(3) === 6, '<code>add(1)(2)(3)</code> should return <code>6</code>.');
|
||||
testString: assert(add(1)(2)(3) === 6);
|
||||
- text: <code>add(11)(22)(33)</code> should return <code>66</code>.
|
||||
testString: assert(add(11)(22)(33) === 66, '<code>add(11)(22)(33)</code> should return <code>66</code>.');
|
||||
testString: assert(add(11)(22)(33) === 66);
|
||||
- text: Your code should include a final statement that returns <code>x + y + z</code>.
|
||||
testString: assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g), 'Your code should include a final statement that returns <code>x + y + z</code>.');
|
||||
testString: assert(code.match(/[xyz]\s*?\+\s*?[xyz]\s*?\+\s*?[xyz]/g));
|
||||
|
||||
```
|
||||
|
||||
|
@ -26,9 +26,9 @@ In the code editor, the <code>prepareTea</code> and <code>getTea</code> function
|
||||
```yml
|
||||
tests:
|
||||
- text: The <code>tea4TeamFCC</code> variable should hold 40 cups of tea for the team.
|
||||
testString: assert(tea4TeamFCC.length === 40, 'The <code>tea4TeamFCC</code> variable should hold 40 cups of tea for the team.');
|
||||
testString: assert(tea4TeamFCC.length === 40);
|
||||
- text: The <code>tea4TeamFCC</code> variable should hold cups of green tea.
|
||||
testString: assert(tea4TeamFCC[0] === 'greenTea', 'The <code>tea4TeamFCC</code> variable should hold cups of green tea.');
|
||||
testString: assert(tea4TeamFCC[0] === 'greenTea');
|
||||
|
||||
```
|
||||
|
||||
|
@ -26,11 +26,11 @@ Write the <code>incrementer</code> function so it takes an argument, and then in
|
||||
```yml
|
||||
tests:
|
||||
- text: Your function <code>incrementer</code> should not change the value of <code>fixedValue</code>.
|
||||
testString: assert(fixedValue === 4, 'Your function <code>incrementer</code> should not change the value of <code>fixedValue</code>.');
|
||||
testString: assert(fixedValue === 4);
|
||||
- text: Your <code>incrementer</code> function should take a parameter.
|
||||
testString: assert(incrementer.length === 1, 'Your <code>incrementer</code> function should take a parameter.');
|
||||
testString: assert(incrementer.length === 1);
|
||||
- text: Your <code>incrementer</code> function should return a value that is one larger than the <code>fixedValue</code> value.
|
||||
testString: assert(newValue === 5, 'Your <code>incrementer</code> function should return a value that is one larger than the <code>fixedValue</code> value.');
|
||||
testString: assert(newValue === 5);
|
||||
|
||||
```
|
||||
|
||||
|
@ -23,7 +23,7 @@ Rewrite the code so the global array <code>bookList</code> is not changed inside
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>bookList</code> should not change and still equal <code>["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]</code>.
|
||||
testString: assert(JSON.stringify(bookList) === JSON.stringify(["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]), '<code>bookList</code> should not change and still equal <code>["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]</code>.');
|
||||
testString: assert(JSON.stringify(bookList) === JSON.stringify(["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]));
|
||||
- text: <code>newBookList</code> should equal <code>["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]</code>.
|
||||
testString: assert(JSON.stringify(newBookList) === JSON.stringify(['The Hound of the Baskervilles', 'On The Electrodynamics of Moving Bodies', 'Philosophiæ Naturalis Principia Mathematica', 'Disquisitiones Arithmeticae', 'A Brief History of Time']), '<code>newBookList</code> should equal <code>["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]</code>.');
|
||||
- text: <code>newerBookList</code> should equal <code>["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]</code>.
|
||||
|
@ -29,13 +29,13 @@ Do not mutate the original array provided to the function.
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>slice</code> method.
|
||||
testString: assert(code.match(/\.slice/g), 'Your code should use the <code>slice</code> method.');
|
||||
testString: assert(code.match(/\.slice/g));
|
||||
- text: Your code should not use the <code>splice</code> method.
|
||||
testString: assert(!code.match(/\.splice/g), 'Your code should not use the <code>splice</code> method.');
|
||||
testString: assert(!code.match(/\.splice/g));
|
||||
- text: The <code>inputCities</code> array should not change.
|
||||
testString: assert(JSON.stringify(inputCities) === JSON.stringify(["Chicago", "Delhi", "Islamabad", "London", "Berlin"]), 'The <code>inputCities</code> array should not change.');
|
||||
testString: assert(JSON.stringify(inputCities) === JSON.stringify(["Chicago", "Delhi", "Islamabad", "London", "Berlin"]));
|
||||
- text: <code>nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])</code> should return <code>["Chicago", "Delhi", "Islamabad"]</code>.
|
||||
testString: assert(JSON.stringify(nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])) === JSON.stringify(["Chicago", "Delhi", "Islamabad"]), '<code>nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])</code> should return <code>["Chicago", "Delhi", "Islamabad"]</code>.');
|
||||
testString: assert(JSON.stringify(nonMutatingSplice(["Chicago", "Delhi", "Islamabad", "London", "Berlin"])) === JSON.stringify(["Chicago", "Delhi", "Islamabad"]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -28,15 +28,15 @@ Use the <code>slice</code> method in the <code>sliceArray</code> function to ret
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>slice</code> method.
|
||||
testString: assert(code.match(/\.slice/g), 'Your code should use the <code>slice</code> method.');
|
||||
testString: assert(code.match(/\.slice/g));
|
||||
- text: The <code>inputAnim</code> variable should not change.
|
||||
testString: assert(JSON.stringify(inputAnim) === JSON.stringify(["Cat", "Dog", "Tiger", "Zebra", "Ant"]), 'The <code>inputAnim</code> variable should not change.');
|
||||
testString: assert(JSON.stringify(inputAnim) === JSON.stringify(["Cat", "Dog", "Tiger", "Zebra", "Ant"]));
|
||||
- text: <code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)</code> should return <code>["Dog", "Tiger"]</code>.
|
||||
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)) === JSON.stringify(["Dog", "Tiger"]), '<code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)</code> should return <code>["Dog", "Tiger"]</code>.');
|
||||
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 3)) === JSON.stringify(["Dog", "Tiger"]));
|
||||
- text: <code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)</code> should return <code>["Cat"]</code>.
|
||||
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)) === JSON.stringify(["Cat"]), '<code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)</code> should return <code>["Cat"]</code>.');
|
||||
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 0, 1)) === JSON.stringify(["Cat"]));
|
||||
- text: <code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)</code> should return <code>["Dog", "Tiger", "Zebra"]</code>.
|
||||
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)) === JSON.stringify(["Dog", "Tiger", "Zebra"]), '<code>sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)</code> should return <code>["Dog", "Tiger", "Zebra"]</code>.');
|
||||
testString: assert(JSON.stringify(sliceArray(["Cat", "Dog", "Tiger", "Zebra", "Ant"], 1, 4)) === JSON.stringify(["Dog", "Tiger", "Zebra"]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -45,13 +45,13 @@ Use the <code>sort</code> method in the <code>alphabeticalOrder</code> function
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>sort</code> method.
|
||||
testString: assert(code.match(/\.sort/g), 'Your code should use the <code>sort</code> method.');
|
||||
testString: assert(code.match(/\.sort/g));
|
||||
- text: <code>alphabeticalOrder(["a", "d", "c", "a", "z", "g"])</code> should return <code>["a", "a", "c", "d", "g", "z"]</code>.
|
||||
testString: assert(JSON.stringify(alphabeticalOrder(["a", "d", "c", "a", "z", "g"])) === JSON.stringify(["a", "a", "c", "d", "g", "z"]), '<code>alphabeticalOrder(["a", "d", "c", "a", "z", "g"])</code> should return <code>["a", "a", "c", "d", "g", "z"]</code>.');
|
||||
testString: assert(JSON.stringify(alphabeticalOrder(["a", "d", "c", "a", "z", "g"])) === JSON.stringify(["a", "a", "c", "d", "g", "z"]));
|
||||
- text: <code>alphabeticalOrder(["x", "h", "a", "m", "n", "m"])</code> should return <code>["a", "h", "m", "m", "n", "x"]</code>.
|
||||
testString: assert(JSON.stringify(alphabeticalOrder(["x", "h", "a", "m", "n", "m"])) === JSON.stringify(["a", "h", "m", "m", "n", "x"]), '<code>alphabeticalOrder(["x", "h", "a", "m", "n", "m"])</code> should return <code>["a", "h", "m", "m", "n", "x"]</code>.');
|
||||
testString: assert(JSON.stringify(alphabeticalOrder(["x", "h", "a", "m", "n", "m"])) === JSON.stringify(["a", "h", "m", "m", "n", "x"]));
|
||||
- text: <code>alphabeticalOrder(["a", "a", "a", "a", "x", "t"])</code> should return <code>["a", "a", "a", "a", "t", "x"]</code>.
|
||||
testString: assert(JSON.stringify(alphabeticalOrder(["a", "a", "a", "a", "x", "t"])) === JSON.stringify(["a", "a", "a", "a", "t", "x"]), '<code>alphabeticalOrder(["a", "a", "a", "a", "x", "t"])</code> should return <code>["a", "a", "a", "a", "t", "x"]</code>.');
|
||||
testString: assert(JSON.stringify(alphabeticalOrder(["a", "a", "a", "a", "x", "t"])) === JSON.stringify(["a", "a", "a", "a", "t", "x"]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -33,13 +33,13 @@ Use the <code>split</code> method inside the <code>splitify</code> function to s
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>split</code> method.
|
||||
testString: assert(code.match(/\.split/g), 'Your code should use the <code>split</code> method.');
|
||||
testString: assert(code.match(/\.split/g));
|
||||
- text: <code>splitify("Hello World,I-am code")</code> should return <code>["Hello", "World", "I", "am", "code"]</code>.
|
||||
testString: assert(JSON.stringify(splitify("Hello World,I-am code")) === JSON.stringify(["Hello", "World", "I", "am", "code"]), '<code>splitify("Hello World,I-am code")</code> should return <code>["Hello", "World", "I", "am", "code"]</code>.');
|
||||
testString: assert(JSON.stringify(splitify("Hello World,I-am code")) === JSON.stringify(["Hello", "World", "I", "am", "code"]));
|
||||
- text: <code>splitify("Earth-is-our home")</code> should return <code>["Earth", "is", "our", "home"]</code>.
|
||||
testString: assert(JSON.stringify(splitify("Earth-is-our home")) === JSON.stringify(["Earth", "is", "our", "home"]), '<code>splitify("Earth-is-our home")</code> should return <code>["Earth", "is", "our", "home"]</code>.');
|
||||
testString: assert(JSON.stringify(splitify("Earth-is-our home")) === JSON.stringify(["Earth", "is", "our", "home"]));
|
||||
- text: <code>splitify("This.is.a-sentence")</code> should return <code>["This", "is", "a", "sentence"]</code>.
|
||||
testString: assert(JSON.stringify(splitify("This.is.a-sentence")) === JSON.stringify(["This", "is", "a", "sentence"]), '<code>splitify("This.is.a-sentence")</code> should return <code>["This", "is", "a", "sentence"]</code>.');
|
||||
testString: assert(JSON.stringify(splitify("This.is.a-sentence")) === JSON.stringify(["This", "is", "a", "sentence"]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -27,13 +27,13 @@ Note: The data (the number of cups of tea) is supplied as the last argument. We'
|
||||
```yml
|
||||
tests:
|
||||
- text: The <code>tea4GreenTeamFCC</code> variable should hold 27 cups of green tea for the team.
|
||||
testString: assert(tea4GreenTeamFCC.length === 27, 'The <code>tea4GreenTeamFCC</code> variable should hold 27 cups of green tea for the team.');
|
||||
testString: assert(tea4GreenTeamFCC.length === 27);
|
||||
- text: The <code>tea4GreenTeamFCC</code> variable should hold cups of green tea.
|
||||
testString: assert(tea4GreenTeamFCC[0] === 'greenTea', 'The <code>tea4GreenTeamFCC</code> variable should hold cups of green tea.');
|
||||
testString: assert(tea4GreenTeamFCC[0] === 'greenTea');
|
||||
- text: The <code>tea4BlackTeamFCC</code> variable should hold 13 cups of black tea.
|
||||
testString: assert(tea4BlackTeamFCC.length === 13, 'The <code>tea4BlackTeamFCC</code> variable should hold 13 cups of black tea.');
|
||||
testString: assert(tea4BlackTeamFCC.length === 13);
|
||||
- text: The <code>tea4BlackTeamFCC</code> variable should hold cups of black tea.
|
||||
testString: assert(tea4BlackTeamFCC[0] === 'blackTea', 'The <code>tea4BlackTeamFCC</code> variable should hold cups of black tea.');
|
||||
testString: assert(tea4BlackTeamFCC[0] === 'blackTea');
|
||||
|
||||
```
|
||||
|
||||
|
@ -30,13 +30,13 @@ Use the <code>every</code> method inside the <code>checkPositive</code> function
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>every</code> method.
|
||||
testString: assert(code.match(/\.every/g), 'Your code should use the <code>every</code> method.');
|
||||
testString: assert(code.match(/\.every/g));
|
||||
- text: <code>checkPositive([1, 2, 3, -4, 5])</code> should return <code>false</code>.
|
||||
testString: assert(!checkPositive([1, 2, 3, -4, 5]), '<code>checkPositive([1, 2, 3, -4, 5])</code> should return <code>false</code>.');
|
||||
testString: assert(!checkPositive([1, 2, 3, -4, 5]));
|
||||
- text: <code>checkPositive([1, 2, 3, 4, 5])</code> should return <code>true</code>.
|
||||
testString: assert(checkPositive([1, 2, 3, 4, 5]), '<code>checkPositive([1, 2, 3, 4, 5])</code> should return <code>true</code>.');
|
||||
testString: assert(checkPositive([1, 2, 3, 4, 5]));
|
||||
- text: <code>checkPositive([1, -2, 3, -4, 5])</code> should return <code>false</code>.
|
||||
testString: assert(!checkPositive([1, -2, 3, -4, 5]), '<code>checkPositive([1, -2, 3, -4, 5])</code> should return <code>false</code>.');
|
||||
testString: assert(!checkPositive([1, -2, 3, -4, 5]));
|
||||
|
||||
```
|
||||
|
||||
|
@ -21,11 +21,11 @@ The variable <code>watchList</code> holds an array of objects with information o
|
||||
```yml
|
||||
tests:
|
||||
- text: The <code>watchList</code> variable should not change.
|
||||
testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron", 'The <code>watchList</code> variable should not change.');
|
||||
testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron");
|
||||
- text: Your code should use the <code>filter</code> method.
|
||||
testString: assert(code.match(/\.filter/g), 'Your code should use the <code>filter</code> method.');
|
||||
testString: assert(code.match(/\.filter/g));
|
||||
- text: Your code should not use a <code>for</code> loop.
|
||||
testString: assert(!code.match(/for\s*?\(.+?\)/g), 'Your code should not use a <code>for</code> loop.');
|
||||
testString: assert(!code.match(/for\s*?\(.+?\)/g));
|
||||
- text: '<code>filteredList</code> should equal <code>[{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]</code>.'
|
||||
testString: 'assert.deepEqual(filteredList, [{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}], ''<code>filteredList</code> should equal <code>[{"title": "Inception","rating": "8.8"},{"title": "Interstellar","rating": "8.6"},{"title": "The Dark Knight","rating": "9.0"},{"title": "Batman Begins","rating": "8.3"}]</code>.'');'
|
||||
|
||||
|
@ -23,15 +23,15 @@ The variable <code>watchList</code> holds an array of objects with information o
|
||||
```yml
|
||||
tests:
|
||||
- text: The <code>watchList</code> variable should not change.
|
||||
testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron", 'The <code>watchList</code> variable should not change.');
|
||||
testString: assert(watchList[0].Title === "Inception" && watchList[4].Director == "James Cameron");
|
||||
- text: Your code should use the <code>reduce</code> method.
|
||||
testString: assert(code.match(/\.reduce/g), 'Your code should use the <code>reduce</code> method.');
|
||||
testString: assert(code.match(/\.reduce/g));
|
||||
- text: The <code>getRating(watchList)</code> should equal 8.675.
|
||||
testString: assert(getRating(watchList) === 8.675, 'The <code>getRating(watchList)</code> should equal 8.675.');
|
||||
testString: assert(getRating(watchList) === 8.675);
|
||||
- text: Your code should not use a <code>for</code> loop.
|
||||
testString: assert(!code.match(/for\s*?\(.*\)/g), 'Your code should not use a <code>for</code> loop.');
|
||||
testString: assert(!code.match(/for\s*?\(.*\)/g));
|
||||
- text: Your code should return correct output after modifying the <code>watchList</code> object.
|
||||
testString: assert(getRating(watchList.filter((_, i) => i < 1 || i > 2)) === 8.55, 'Your code should return correct output after modifying the <code>watchList</code> object');
|
||||
testString: assert(getRating(watchList.filter((_, i) => i < 1 || i > 2)) === 8.55);
|
||||
|
||||
```
|
||||
|
||||
|
@ -30,13 +30,13 @@ Use the <code>some</code> method inside the <code>checkPositive</code> function
|
||||
```yml
|
||||
tests:
|
||||
- text: Your code should use the <code>some</code> method.
|
||||
testString: assert(code.match(/\.some/g), 'Your code should use the <code>some</code> method.');
|
||||
testString: assert(code.match(/\.some/g));
|
||||
- text: <code>checkPositive([1, 2, 3, -4, 5])</code> should return <code>true</code>.
|
||||
testString: assert(checkPositive([1, 2, 3, -4, 5]), '<code>checkPositive([1, 2, 3, -4, 5])</code> should return <code>true</code>.');
|
||||
testString: assert(checkPositive([1, 2, 3, -4, 5]));
|
||||
- text: <code>checkPositive([1, 2, 3, 4, 5])</code> should return <code>true</code>.
|
||||
testString: assert(checkPositive([1, 2, 3, 4, 5]), '<code>checkPositive([1, 2, 3, 4, 5])</code> should return <code>true</code>.');
|
||||
testString: assert(checkPositive([1, 2, 3, 4, 5]));
|
||||
- text: <code>checkPositive([-1, -2, -3, -4, -5])</code> should return <code>false</code>.
|
||||
testString: assert(!checkPositive([-1, -2, -3, -4, -5]), '<code>checkPositive([-1, -2, -3, -4, -5])</code> should return <code>false</code>.');
|
||||
testString: assert(!checkPositive([-1, -2, -3, -4, -5]));
|
||||
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user