fix(curriculum): quotes in tests (#18828)

* fix(curriculum): tests quotes

* fix(curriculum): fill seed-teardown

* fix(curriculum): fix tests and remove unneeded seed-teardown
This commit is contained in:
Valeriy
2018-10-20 21:02:47 +03:00
committed by mrugesh mohapatra
parent 96eb124163
commit 79d9012432
1339 changed files with 6499 additions and 5185 deletions

View File

@ -19,10 +19,10 @@ The function <code>raiseToPower</code> raises a base to an exponent. Unfortunate
```yml
tests:
- text: 'Your code should fix the variable <code>power</code> so it equals 2 raised to the 3rd power, not 3 raised to the 2nd power.'
testString: 'assert(power == 8, "Your code should fix the variable <code>power</code> so it equals 2 raised to the 3rd power, not 3 raised to the 2nd power.");'
- text: Your code should fix the variable <code>power</code> so it equals 2 raised to the 3rd power, not 3 raised to the 2nd power.
testString: assert(power == 8, 'Your code should fix the variable <code>power</code> so it equals 2 raised to the 3rd power, not 3 raised to the 2nd power.');
- text: Your code should use the correct order of the arguments for the <code>raiseToPower</code> function call.
testString: 'assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g), "Your code should use the correct order of the arguments for the <code>raiseToPower</code> function call.");'
testString: assert(code.match(/raiseToPower\(\s*?base\s*?,\s*?exp\s*?\);/g), 'Your code should use the correct order of the arguments for the <code>raiseToPower</code> function call.');
```

View File

@ -22,9 +22,9 @@ Fix the code so the variable <code>result</code> is set to the value returned fr
```yml
tests:
- text: Your code should fix the variable <code>result</code> so it is set to the number that the function <code>getNine</code> returns.
testString: 'assert(result == 9, "Your code should fix the variable <code>result</code> so it is set to the number that the function <code>getNine</code> returns.");'
testString: assert(result == 9, 'Your code should fix the variable <code>result</code> so it is set to the number that the function <code>getNine</code> returns.');
- text: Your code should call the <code>getNine</code> function.
testString: 'assert(code.match(/getNine\(\)/g).length == 2, "Your code should call the <code>getNine</code> function.");'
testString: assert(code.match(/getNine\(\)/g).length == 2, 'Your code should call the <code>getNine</code> function.');
```

View File

@ -21,15 +21,15 @@ Fix the two spelling errors in the code so the <code>netWorkingCapital</code> ca
```yml
tests:
- text: 'Check the spelling of the two variables used in the netWorkingCapital calculation, the console output should show that "Net working capital is: 2".'
testString: 'assert(netWorkingCapital === 2, "Check the spelling of the two variables used in the netWorkingCapital calculation, the console output should show that "Net working capital is: 2".");'
testString: 'assert(netWorkingCapital === 2, ''Check the spelling of the two variables used in the netWorkingCapital calculation, the console output should show that "Net working capital is: 2".'');'
- text: There should be no instances of mis-spelled variables in the code.
testString: 'assert(!code.match(/recievables/g), "There should be no instances of mis-spelled variables in the code.");'
testString: assert(!code.match(/recievables/g), 'There should be no instances of mis-spelled variables in the code.');
- text: The <code>receivables</code> variable should be declared and used properly in the code.
testString: 'assert(code.match(/receivables/g).length == 2, "The <code>receivables</code> variable should be declared and used properly in the code.");'
testString: assert(code.match(/receivables/g).length == 2, 'The <code>receivables</code> variable should be declared and used properly in the code.');
- text: There should be no instances of mis-spelled variables in the code.
testString: 'assert(!code.match(/payable;/g), "There should be no instances of mis-spelled variables in the code.");'
testString: assert(!code.match(/payable;/g), 'There should be no instances of mis-spelled variables in the code.');
- text: The <code>payables</code> variable should be declared and used properly in the code.
testString: 'assert(code.match(/payables/g).length == 2, "The <code>payables</code> variable should be declared and used properly in the code.");'
testString: assert(code.match(/payables/g).length == 2, 'The <code>payables</code> variable should be declared and used properly in the code.');
```

View File

@ -6,7 +6,7 @@ challengeType: 1
## Description
<section id='description'>
JavaScript allows the use of both single (") and double ("") quotes to declare a string. Deciding which one to use generally comes down to personal preference, with some exceptions.
JavaScript allows the use of both single ('') and double ("") quotes to declare a string. Deciding which one to use generally comes down to personal preference, with some exceptions.
Having two choices is great when a string has contractions or another piece of text that's in quotes. Just be careful that you don't close the string too early, which causes a syntax error.
Here are some examples of mixing quotes:
<blockquote>// These are correct:<br>const grouchoContraction = "I've had a perfectly wonderful evening, but this wasn't it.";<br>const quoteInString = "Groucho Marx once said 'Quote me as saying I was mis-quoted.'";<br>// This is incorrect:<br>const uhOhGroucho = 'I've had a perfectly wonderful evening, but this wasn't it.';</blockquote>
@ -24,10 +24,10 @@ Fix the string so it either uses different quotes for the <code>href</code> valu
```yml
tests:
- text: 'Your code should fix the quotes around the <code>href</code> value "#Home" by either changing or escaping them.'
testString: 'assert(code.match(/<a href=\s*?("|\\")#Home\1\s*?>/g), "Your code should fix the quotes around the <code>href</code> value "#Home" by either changing or escaping them.");'
- text: Your code should fix the quotes around the <code>href</code> value "#Home" by either changing or escaping them.
testString: assert(code.match(/<a href=\s*?('|\\")#Home\1\s*?>/g), 'Your code should fix the quotes around the <code>href</code> value "#Home" by either changing or escaping them.');
- text: Your code should keep the double quotes around the entire string.
testString: 'assert(code.match(/"<p>.*?<\/p>";/g), "Your code should keep the double quotes around the entire string.");'
testString: assert(code.match(/"<p>.*?<\/p>";/g), 'Your code should keep the double quotes around the entire string.');
```

View File

@ -22,13 +22,13 @@ Fix the two indexing errors in the following function so all the numbers 1 throu
```yml
tests:
- text: Your code should set the initial condition of the loop so it starts at the first index.
testString: 'assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1, "Your code should set the initial condition of the loop so it starts at the first index.");'
testString: assert(code.match(/i\s*?=\s*?0\s*?;/g).length == 1, 'Your code should set the initial condition of the loop so it starts at the first index.');
- text: Your code should fix the initial condition of the loop so that the index starts at 0.
testString: 'assert(!code.match(/i\s?=\s*?1\s*?;/g), "Your code should fix the initial condition of the loop so that the index starts at 0.");'
testString: assert(!code.match(/i\s?=\s*?1\s*?;/g), 'Your code should fix the initial condition of the loop so that the index starts at 0.');
- text: Your code should set the terminal condition of the loop so it stops at the last index.
testString: 'assert(code.match(/i\s*?<\s*?len\s*?;/g).length == 1, "Your code should set the terminal condition of the loop so it stops at the last index.");'
testString: assert(code.match(/i\s*?<\s*?len\s*?;/g).length == 1, 'Your code should set the terminal condition of the loop so it stops at the last index.');
- text: Your code should fix the terminal condition of the loop so that it stops at 1 before the length.
testString: 'assert(!code.match(/i\s*?<=\s*?len;/g), "Your code should fix the terminal condition of the loop so that it stops at 1 before the length.");'
testString: assert(!code.match(/i\s*?<=\s*?len;/g), 'Your code should fix the terminal condition of the loop so that it stops at 1 before the length.');
```

View File

@ -21,9 +21,9 @@ Fix the two pair errors in the code.
```yml
tests:
- text: Your code should fix the missing piece of the array.
testString: 'assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g), "Your code should fix the missing piece of the array.");'
testString: assert(code.match(/myArray\s*?=\s*?\[\s*?1\s*?,\s*?2\s*?,\s*?3\s*?\];/g), 'Your code should fix the missing piece of the array.');
- text: 'Your code should fix the missing piece of the <code>.reduce()</code> method. The console output should show that "Sum of array values is: 6".'
testString: 'assert(arraySum === 6, "Your code should fix the missing piece of the <code>.reduce()</code> method. The console output should show that "Sum of array values is: 6".");'
testString: 'assert(arraySum === 6, ''Your code should fix the missing piece of the <code>.reduce()</code> method. The console output should show that "Sum of array values is: 6".'');'
```

View File

@ -23,10 +23,10 @@ Fix the condition so the program runs the right branch, and the appropriate valu
```yml
tests:
- text: 'Your code should fix the condition so it checks for equality, instead of using assignment.'
testString: 'assert(result == "Not equal!", "Your code should fix the condition so it checks for equality, instead of using assignment.");'
- text: Your code should fix the condition so it checks for equality, instead of using assignment.
testString: assert(result == "Not equal!", 'Your code should fix the condition so it checks for equality, instead of using assignment.');
- text: The condition can use either <code>==</code> or <code>===</code> to test for equality.
testString: 'assert(code.match(/x\s*?===?\s*?y/g), "The condition can use either <code>==</code> or <code>===</code> to test for equality.");'
testString: assert(code.match(/x\s*?===?\s*?y/g), 'The condition can use either <code>==</code> or <code>===</code> to test for equality.');
```

View File

@ -23,9 +23,9 @@ The <code>myFunc()</code> function contains an infinite loop because the termina
```yml
tests:
- text: Your code should change the comparison operator in the terminal condition (the middle part) of the <code>for</code> loop.
testString: 'assert(code.match(/i\s*?<=\s*?4;/g).length == 1, "Your code should change the comparison operator in the terminal condition (the middle part) of the <code>for</code> loop.");'
testString: assert(code.match(/i\s*?<=\s*?4;/g).length == 1, 'Your code should change the comparison operator in the terminal condition (the middle part) of the <code>for</code> loop.');
- text: Your code should fix the comparison operator in the terminal condition of the loop.
testString: 'assert(!code.match(/i\s*?!=\s*?4;/g), "Your code should fix the comparison operator in the terminal condition of the loop.");'
testString: assert(!code.match(/i\s*?!=\s*?4;/g), 'Your code should fix the comparison operator in the terminal condition of the loop.');
```

View File

@ -26,11 +26,11 @@ Use <code>console.log()</code> to print the variables in the code where indicate
```yml
tests:
- text: Use <code>console.log()</code> to print the <code>outputTwo</code> variable. In your Browser Console this should print out the value of the variable two times.
testString: 'assert(code.match(/console\.log\(outputTwo\)/g), "Use <code>console.log()</code> to print the <code>outputTwo</code> variable. In your Browser Console this should print out the value of the variable two times.");'
testString: assert(code.match(/console\.log\(outputTwo\)/g), 'Use <code>console.log()</code> to print the <code>outputTwo</code> variable. In your Browser Console this should print out the value of the variable two times.');
- text: Use <code>console.log()</code> to print the <code>outputOne</code> variable.
testString: 'assert(code.match(/console\.log\(outputOne\)/g), "Use <code>console.log()</code> to print the <code>outputOne</code> variable.");'
testString: assert(code.match(/console\.log\(outputOne\)/g), 'Use <code>console.log()</code> to print the <code>outputOne</code> variable.');
- text: Use <code>console.clear()</code> to modify your output so that <code>outputOne</code> variable only outputs once.
testString: 'assert(code.match(/^(\s*console.clear\(\);?\s*)$/gm), "Use <code>console.clear()</code> to modify your output so that <code>outputOne</code> variable only outputs once.");'
testString: assert(code.match(/^(\s*console.clear\(\);?\s*)$/gm), 'Use <code>console.clear()</code> to modify your output so that <code>outputOne</code> variable only outputs once.');
```

View File

@ -21,11 +21,11 @@ The following function is supposed to create a two-dimensional array with <code>
```yml
tests:
- text: Your code should set the <code>matrix</code> variable to an array holding 3 rows of 2 columns of zeroes each.
testString: 'assert(JSON.stringify(matrix) == "[[0,0],[0,0],[0,0]]", "Your code should set the <code>matrix</code> variable to an array holding 3 rows of 2 columns of zeroes each.");'
testString: assert(JSON.stringify(matrix) == "[[0,0],[0,0],[0,0]]", 'Your code should set the <code>matrix</code> variable to an array holding 3 rows of 2 columns of zeroes each.');
- text: The <code>matrix</code> variable should have 3 rows.
testString: 'assert(matrix.length == 3, "The <code>matrix</code> variable should have 3 rows.");'
testString: assert(matrix.length == 3, 'The <code>matrix</code> variable should have 3 rows.');
- text: The <code>matrix</code> variable should have 2 columns in each row.
testString: 'assert(matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2, "The <code>matrix</code> variable should have 2 columns in each row.");'
testString: assert(matrix[0].length == 2 && matrix[1].length === 2 && matrix[2].length === 2, 'The <code>matrix</code> variable should have 2 columns in each row.');
```

View File

@ -24,7 +24,7 @@ Use the <code>console.log()</code> method to print the value of the variable <co
```yml
tests:
- text: Your code should use <code>console.log()</code> to check the value of the variable <code>a</code>.
testString: 'assert(code.match(/console\.log\(a\)/g), "Your code should use <code>console.log()</code> to check the value of the variable <code>a</code>.");'
testString: assert(code.match(/console\.log\(a\)/g), 'Your code should use <code>console.log()</code> to check the value of the variable <code>a</code>.');
```

View File

@ -23,11 +23,11 @@ Add two <code>console.log()</code> statements to check the <code>typeof</code> e
```yml
tests:
- text: Your code should use <code>typeof</code> in two <code>console.log()</code> statements to check the type of the variables.
testString: 'assert(code.match(/console\.log\(typeof[\( ].*\)?\)/g).length == 2, "Your code should use <code>typeof</code> in two <code>console.log()</code> statements to check the type of the variables.");'
testString: assert(code.match(/console\.log\(typeof[\( ].*\)?\)/g).length == 2, 'Your code should use <code>typeof</code> in two <code>console.log()</code> statements to check the type of the variables.');
- text: Your code should use <code>typeof</code> to check the type of the variable <code>seven</code>.
testString: 'assert(code.match(/typeof[\( ]seven\)?/g), "Your code should use <code>typeof</code> to check the type of the variable <code>seven</code>.");'
testString: assert(code.match(/typeof[\( ]seven\)?/g), 'Your code should use <code>typeof</code> to check the type of the variable <code>seven</code>.');
- text: Your code should use <code>typeof</code> to check the type of the variable <code>three</code>.
testString: 'assert(code.match(/typeof[\( ]three\)?/g), "Your code should use <code>typeof</code> to check the type of the variable <code>three</code>.");'
testString: assert(code.match(/typeof[\( ]three\)?/g), 'Your code should use <code>typeof</code> to check the type of the variable <code>three</code>.');
```