Merge pull request #2 from Bouncey/fix/testFormatting

Correct test formatting
This commit is contained in:
Stuart Taylor
2018-04-08 22:28:19 +01:00
committed by Mrugesh Mohapatra
parent 1f5abb3dde
commit c72e1fdd5f
17 changed files with 3483 additions and 3483 deletions

View File

@@ -18,8 +18,8 @@
],
"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>.')"
"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>.');"
}
],
"solutions": [],
@@ -64,16 +64,16 @@
],
"tests": [
{
"text": "Use <code>console.log()</code> to print the <code>outputTwice</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>outputTwice</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>outputTwice</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>outputTwice</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.')"
"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.');"
},
{
"text": "Use <code>console.clear()</code> to modify your output so that <code>outputOne</code> variable only outputs once.'",
"testString": "assert(code.match(/console\\.clear\\(\\)/g), 'Use <code>console.clear()</code> to modify your output so that <code>outputOne</code> variable only outputs once.')"
"text": "Use <code>console.clear()</code> to modify your output so that <code>outputOne</code> variable only outputs once.",
"testString": "assert(code.match(/console\\.clear\\(\\)/g), 'Use <code>console.clear()</code> to modify your output so that <code>outputOne</code> variable only outputs once.');"
}
],
"solutions": [],
@@ -119,16 +119,16 @@
],
"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.')"
"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.');"
},
{
"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>.')"
"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>.');"
},
{
"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>.')"
"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>.');"
}
],
"solutions": [],
@@ -165,24 +165,24 @@
],
"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\".')"
"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\".');"
},
{
"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.')"
"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.');"
},
{
"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.')"
"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.');"
},
{
"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.')"
"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.');"
},
{
"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.')"
"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.');"
}
],
"solutions": [],
@@ -218,12 +218,12 @@
],
"tests": [
{
"text": "Your code should fix the missing piece of the array.'",
"testString": "assert(code.match(/myArray\\s*?=\\s*?\\[\\s*?1\\s*?, 'Your code should fix the missing piece of the array.')"
"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.');"
},
{
"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\".')"
"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\".');"
}
],
"solutions": [],
@@ -262,12 +262,12 @@
],
"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.')"
"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.');"
}
],
"solutions": [],
@@ -304,12 +304,12 @@
],
"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.')"
"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.');"
}
],
"solutions": [],
@@ -353,12 +353,12 @@
],
"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.')"
"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.');"
},
{
"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.')"
"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.');"
}
],
"solutions": [],
@@ -397,12 +397,12 @@
],
"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*?, 'Your code should use the correct order of the arguments for the <code>raiseToPower</code> function call.')"
"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.');"
}
],
"solutions": [],
@@ -443,20 +443,20 @@
],
"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.')"
"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.');"
},
{
"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.')"
"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.');"
},
{
"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.')"
"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.');"
},
{
"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.')"
"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.');"
}
],
"solutions": [],
@@ -499,16 +499,16 @@
],
"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, 'Your code should set the <code>matrix</code> variable to an array holding 3 rows of 2 columns of zeroes each.')"
"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.');"
},
{
"text": "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 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.')"
"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.');"
}
],
"solutions": [],
@@ -561,12 +561,12 @@
],
"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.')"
"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.');"
},
{
"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.')"
"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.');"
}
],
"solutions": [],