From f834a9899a47812e6b827a80bc63f20ae455f825 Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Fri, 31 Aug 2018 16:52:46 +0200 Subject: [PATCH] fix(challenges): reword test text and improve test accuracy --- .../es6.json | 313 ++++++++++++------ 1 file changed, 208 insertions(+), 105 deletions(-) diff --git a/challenges/02-javascript-algorithms-and-data-structures/es6.json b/challenges/02-javascript-algorithms-and-data-structures/es6.json index e0bf974cc..20cb043b9 100644 --- a/challenges/02-javascript-algorithms-and-data-structures/es6.json +++ b/challenges/02-javascript-algorithms-and-data-structures/es6.json @@ -26,15 +26,19 @@ "tests": [ { "text": "var does not exist in code.", - "testString": "getUserInput => assert(!getUserInput('index').match(/var/g),'var does not exist in code.');" + "testString": + "getUserInput => assert(!getUserInput('index').match(/var/g),'var does not exist in code.');" }, { "text": "catName should be Oliver.", - "testString": "assert(catName === \"Oliver\", 'catName should be Oliver.');" + "testString": + "assert(catName === \"Oliver\", 'catName should be Oliver.');" }, { - "text": "quote should be \"Oliver says Meow!\"", - "testString": "assert(quote === \"Oliver says Meow!\", 'quote should be \"Oliver says Meow!\"');" + "text": + "quote should be \"Oliver says Meow!\"", + "testString": + "assert(quote === \"Oliver says Meow!\", 'quote should be \"Oliver says Meow!\"');" } ], "releasedOn": "Feb 17, 2017", @@ -84,15 +88,19 @@ "tests": [ { "text": "var does not exist in code.", - "testString": "getUserInput => assert(!getUserInput('index').match(/var/g),'var does not exist in code.');" + "testString": + "getUserInput => assert(!getUserInput('index').match(/var/g),'var does not exist in code.');" }, { - "text": "The variable i declared in the if statement should equal \"block scope\".", - "testString": "getUserInput => assert(getUserInput('index').match(/(i\\s*=\\s*).*\\s*.*\\s*.*\\1('|\")block\\s*scope\\2/g), 'The variable i declared in the if statement should equal \"block scope\".');" + "text": + "The variable i declared in the if statement should equal \"block scope\".", + "testString": + "getUserInput => assert(getUserInput('index').match(/(i\\s*=\\s*).*\\s*.*\\s*.*\\1('|\")block\\s*scope\\2/g), 'The variable i declared in the if statement should equal \"block scope\".');" }, { "text": "checkScope() should return \"function scope\"", - "testString": "assert(checkScope() === \"function scope\", 'checkScope() should return \"function scope\"');" + "testString": + "assert(checkScope() === \"function scope\", 'checkScope() should return \"function scope\"');" } ], "releasedOn": "Feb 17, 2017", @@ -134,19 +142,25 @@ "tests": [ { "text": "var does not exist in your code.", - "testString": "getUserInput => assert(!getUserInput('index').match(/var/g),'var does not exist in your code.');" + "testString": + "getUserInput => assert(!getUserInput('index').match(/var/g),'var does not exist in your code.');" }, { - "text": "SENTENCE should be a constant variable declared with const.", - "testString": "getUserInput => assert(getUserInput('index').match(/(const SENTENCE)/g), 'SENTENCE should be a constant variable declared with const.');" + "text": + "SENTENCE should be a constant variable declared with const.", + "testString": + "getUserInput => assert(getUserInput('index').match(/(const SENTENCE)/g), 'SENTENCE should be a constant variable declared with const.');" }, { "text": "i should be declared with let.", - "testString": "getUserInput => assert(getUserInput('index').match(/(let i)/g), 'i should be declared with let.');" + "testString": + "getUserInput => assert(getUserInput('index').match(/(let i)/g), 'i should be declared with let.');" }, { - "text": "console.log should be changed to print the SENTENCE variable.", - "testString": "getUserInput => assert(getUserInput('index').match(/console\\.log\\(\\s*SENTENCE\\s*\\)\\s*;?/g), 'console.log should be adjusted to print the variable SENTENCE.');" + "text": + "console.log should be changed to print the SENTENCE variable.", + "testString": + "getUserInput => assert(getUserInput('index').match(/console\\.log\\(\\s*SENTENCE\\s*\\)\\s*;?/g), 'console.log should be adjusted to print the variable SENTENCE.');" } ], "releasedOn": "Feb 17, 2017", @@ -193,19 +207,24 @@ "tests": [ { "text": "Do not replace const keyword.", - "testString": "getUserInput => assert(getUserInput('index').match(/const/g), 'Do not replace const keyword.');" + "testString": + "getUserInput => assert(getUserInput('index').match(/const/g), 'Do not replace const keyword.');" }, { - "text": "s should be a constant variable (by using const).", - "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+s/g), 's should be a constant variable (by using const).');" + "text": + "s should be a constant variable (by using const).", + "testString": + "getUserInput => assert(getUserInput('index').match(/const\\s+s/g), 's should be a constant variable (by using const).');" }, { "text": "Do 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), 'Do 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), 'Do not change the original array declaration.');" }, { "text": "s should be equal to [2, 5, 7].", - "testString": "assert.deepEqual(s, [2, 5, 7], 's should be equal to [2, 5, 7].');" + "testString": + "assert.deepEqual(s, [2, 5, 7], 's should be equal to [2, 5, 7].');" } ], "releasedOn": "Feb 17, 2017", @@ -246,19 +265,24 @@ "tests": [ { "text": "Do not replace const keyword.", - "testString": "getUserInput => assert(getUserInput('index').match(/const/g), 'Do not replace const keyword.');" + "testString": + "getUserInput => assert(getUserInput('index').match(/const/g), 'Do not replace const keyword.');" }, { - "text": "MATH_CONSTANTS should be a constant variable (by using const).", - "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+MATH_CONSTANTS/g), 'MATH_CONSTANTS should be a constant variable (by using const).');" + "text": + "MATH_CONSTANTS should be a constant variable (by using const).", + "testString": + "getUserInput => assert(getUserInput('index').match(/const\\s+MATH_CONSTANTS/g), 'MATH_CONSTANTS should be a constant variable (by using const).');" }, { "text": "Do not change original MATH_CONSTANTS.", - "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+MATH_CONSTANTS\\s+=\\s+{\\s+PI:\\s+3.14\\s+};/g), 'Do not change original MATH_CONSTANTS.');" + "testString": + "getUserInput => assert(getUserInput('index').match(/const\\s+MATH_CONSTANTS\\s+=\\s+{\\s+PI:\\s+3.14\\s+};/g), 'Do not change original MATH_CONSTANTS.');" }, { "text": "PI equals 3.14.", - "testString": "assert(PI === 3.14, 'PI equals 3.14.');" + "testString": + "assert(PI === 3.14, 'PI equals 3.14.');" } ], "releasedOn": "Aug 12, 2017", @@ -311,23 +335,29 @@ "tests": [ { "text": "User did replace var keyword.", - "testString": "getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace var keyword.');" + "testString": + "getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace var keyword.');" }, { - "text": "magic should be a constant variable (by using const).", - "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+magic/g), 'magic should be a constant variable (by using const).');" + "text": + "magic should be a constant variable (by using const).", + "testString": + "getUserInput => assert(getUserInput('index').match(/const\\s+magic/g), 'magic should be a constant variable (by using const).');" }, { "text": "magic is a function.", - "testString": "assert(typeof magic === 'function', 'magic is a function.');" + "testString": + "assert(typeof magic === 'function', 'magic is a function.');" }, { "text": "magic() returns correct date.", - "testString": "assert(magic().getDate() == new Date().getDate(), 'magic() returns correct date.');" + "testString": + "assert(magic().getDate() == new Date().getDate(), 'magic() returns correct date.');" }, { "text": "function keyword was not used.", - "testString": "getUserInput => assert(!getUserInput('index').match(/function/g), 'function keyword was not used.');" + "testString": + "getUserInput => assert(!getUserInput('index').match(/function/g), 'function keyword was not used.');" } ], "releasedOn": "Feb 17, 2017", @@ -362,23 +392,30 @@ "tests": [ { "text": "User did replace var keyword.", - "testString": "getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace var keyword.');" + "testString": + "getUserInput => assert(!getUserInput('index').match(/var/g), 'User did replace var keyword.');" }, { - "text": "myConcat should be a constant variable (by using const).", - "testString": "getUserInput => assert(getUserInput('index').match(/const\\s+myConcat/g), 'myConcat should be a constant variable (by using const).');" + "text": + "myConcat should be a constant variable (by using const).", + "testString": + "getUserInput => assert(getUserInput('index').match(/const\\s+myConcat/g), 'myConcat should be a constant variable (by using const).');" }, { "text": "myConcat should be a function", - "testString": "assert(typeof myConcat === 'function', 'myConcat should be a function');" + "testString": + "assert(typeof myConcat === 'function', 'myConcat should be a function');" }, { - "text": "myConcat() returns the correct array", - "testString": "assert(() => { const a = myConcat([1], [2]); return a[0] == 1 && a[1] == 2; }, 'myConcat() returns the correct array');" + "text": + "myConcat() returns the correct array", + "testString": + "assert(() => { const a = myConcat([1], [2]); return a[0] == 1 && a[1] == 2; }, 'myConcat() returns the correct array');" }, { "text": "function keyword was not used.", - "testString": "getUserInput => assert(!getUserInput('index').match(/function/g), 'function keyword was not used.');" + "testString": + "getUserInput => assert(!getUserInput('index').match(/function/g), 'function keyword was not used.');" } ], "releasedOn": "Feb 17, 2017", @@ -424,8 +461,10 @@ "getUserInput => assert(getUserInput('index').match(/const\\s+squaredIntegers/g), 'squaredIntegers should be a constant variable (by using const).');" }, { - "text": "squaredIntegers should be an array", - "testString": "assert(Array.isArray(squaredIntegers), 'squaredIntegers should be an array');" + "text": + "squaredIntegers should be an array", + "testString": + "assert(Array.isArray(squaredIntegers), 'squaredIntegers should be an array');" }, { "text": @@ -435,15 +474,19 @@ }, { "text": "function keyword was not used.", - "testString": "getUserInput => assert(!getUserInput('index').match(/function/g), 'function keyword was not used.');" + "testString": + "getUserInput => assert(!getUserInput('index').match(/function/g), 'function keyword was not used.');" }, { "text": "loop should not be used", - "testString": "getUserInput => assert(!getUserInput('index').match(/(for)|(while)/g), 'loop should not be used');" + "testString": + "getUserInput => assert(!getUserInput('index').match(/(for)|(while)/g), 'loop should not be used');" }, { - "text": "map, filter, or reduce should be used", - "testString": "getUserInput => assert(getUserInput('index').match(/map|filter|reduce/g), 'map, filter, or reduce should be used');" + "text": + "map, filter, or reduce should be used", + "testString": + "getUserInput => assert(getUserInput('index').match(/map|filter|reduce/g), 'map, filter, or reduce should be used');" } ], "releasedOn": "Feb 17, 2017", @@ -485,16 +528,22 @@ ], "tests": [ { - "text": "The result of increment(5, 2) should be 7.", - "testString": "assert(increment(5, 2) === 7, 'The result of increment(5, 2) should be 7.');" + "text": + "The result of increment(5, 2) should be 7.", + "testString": + "assert(increment(5, 2) === 7, 'The result of increment(5, 2) should be 7.');" }, { - "text": "The result of increment(5) should be 6.", - "testString": "assert(increment(5) === 6, 'The result of increment(5) should be 6.');" + "text": + "The result of increment(5) should be 6.", + "testString": + "assert(increment(5) === 6, 'The result of increment(5) should be 6.');" }, { - "text": "default parameter 1 was used for value.", - "testString": "getUserInput => assert(getUserInput('index').match(/value\\s*=\\s*1/g), 'default parameter 1 was used for value.');" + "text": + "default parameter 1 was used for value.", + "testString": + "getUserInput => assert(getUserInput('index').match(/value\\s*=\\s*1/g), 'default parameter 1 was used for value.');" } ], "releasedOn": "Feb 17, 2017", @@ -534,23 +583,29 @@ "tests": [ { "text": "The result of sum(0,1,2) should be 3", - "testString": "assert(sum(0,1,2) === 3, 'The result of sum(0,1,2) should be 3');" + "testString": + "assert(sum(0,1,2) === 3, 'The result of sum(0,1,2) should be 3');" }, { "text": "The result of sum(1,2,3,4) should be 10", - "testString": "assert(sum(1,2,3,4) === 10, 'The result of sum(1,2,3,4) should be 10');" + "testString": + "assert(sum(1,2,3,4) === 10, 'The result of sum(1,2,3,4) should be 10');" }, { "text": "The result of sum(5) should be 5", - "testString": "assert(sum(5) === 5, 'The result of sum(5) should be 5');" + "testString": + "assert(sum(5) === 5, 'The result of sum(5) should be 5');" }, { "text": "The result of sum() should be 0", - "testString": "assert(sum() === 0, 'The result of sum() should be 0');" + "testString": + "assert(sum() === 0, 'The result of sum() should be 0');" }, { - "text": "The sum function uses the ... spread operator on the args parameter.", - "testString": "getUserInput => assert(getUserInput('index').match(/function\\s+sum\\s*\\(\\s*...args\\s*\\)\\s*{/g), 'The sum function uses the ... spread operator on the args parameter.');" + "text": + "The sum function uses the ... spread operator on the args parameter.", + "testString": + "getUserInput => assert(getUserInput('index').match(/function\\s+sum\\s*\\(\\s*...args\\s*\\)\\s*{/g), 'The sum function uses the ... spread operator on the args parameter.');" } ], "releasedOn": "Feb 17, 2017", @@ -595,15 +650,20 @@ "tests": [ { "text": "arr2 is correct copy of arr1.", - "testString": "assert(arr2.every((v, i) => v === arr1[i]), 'arr2 is correct copy of arr1.');" + "testString": + "assert(arr2.every((v, i) => v === arr1[i]), 'arr2 is correct copy of arr1.');" }, { - "text": "... spread operator was used to duplicate arr1.", - "testString": "getUserInput => assert(getUserInput('index').match(/\\[\\s*...arr1\\s*\\]/g),'... spread operator was used to duplicate arr1.');" + "text": + "... spread operator was used to duplicate arr1.", + "testString": + "getUserInput => assert(getUserInput('index').match(/\\[\\s*...arr1\\s*\\]/g),'... spread operator was used to duplicate arr1.');" }, { - "text": "arr2 remains unchanged when arr1 is changed.", - "testString": "assert((arr1, arr2) => {arr1.push('JUN'); return arr2.length < arr1.length},'arr2 remains unchanged when arr1 is changed.');" + "text": + "arr2 remains unchanged when arr1 is changed.", + "testString": + "assert((arr1, arr2) => {arr1.push('JUN'); return arr2.length < arr1.length},'arr2 remains unchanged when arr1 is changed.');" } ], "releasedOn": "Feb 17, 2017", @@ -646,12 +706,15 @@ ], "tests": [ { - "text": "getTempOfTmrw(AVG_TEMPERATURES) should be 79", - "testString": "assert(getTempOfTmrw(AVG_TEMPERATURES) === 79, 'getTempOfTmrw(AVG_TEMPERATURES) should be 79');" + "text": + "getTempOfTmrw(AVG_TEMPERATURES) should be 79", + "testString": + "assert(getTempOfTmrw(AVG_TEMPERATURES) === 79, 'getTempOfTmrw(AVG_TEMPERATURES) should be 79');" }, { "text": "destructuring with reassignment was used", - "testString": "getUserInput => assert(getUserInput('index').match(/\\{\\s*tomorrow\\s*:\\s*tempOfTomorrow\\s*}\\s*=\\s*avgTemperatures/g),'destructuring with reassignment was used');" + "testString": + "getUserInput => assert(getUserInput('index').match(/\\{\\s*tomorrow\\s*:\\s*tempOfTomorrow\\s*}\\s*=\\s*avgTemperatures/g),'destructuring with reassignment was used');" } ], "releasedOn": "Feb 17, 2017", @@ -685,7 +748,8 @@ }, { "id": "587d7b89367417b2b2512b4a", - "title": "Use Destructuring Assignment to Assign Variables from Nested Objects", + "title": + "Use Destructuring Assignment to Assign Variables from Nested Objects", "description": [ "We can similarly destructure nested objects into variables.", "Consider the following code:", @@ -697,11 +761,13 @@ "tests": [ { "text": "maxOfTomorrow equals 84.6", - "testString": "assert(getMaxOfTmrw(LOCAL_FORECAST) === 84.6, 'maxOfTomorrow equals 84.6');" + "testString": + "assert(getMaxOfTmrw(LOCAL_FORECAST) === 84.6, 'maxOfTomorrow equals 84.6');" }, { "text": "nested destructuring was used", - "testString": "getUserInput => assert(getUserInput('index').match(/\\{\\s*tomorrow\\s*:\\s*\\{\\s*max\\s*:\\s*maxOfTomorrow\\s*\\}\\s*\\}\\s*=\\s*forecast/g),'nested destructuring was used');" + "testString": + "getUserInput => assert(getUserInput('index').match(/\\{\\s*tomorrow\\s*:\\s*\\{\\s*max\\s*:\\s*maxOfTomorrow\\s*\\}\\s*\\}\\s*=\\s*forecast/g),'nested destructuring was used');" } ], "releasedOn": "Feb 17, 2017", @@ -750,15 +816,18 @@ "tests": [ { "text": "Value of a should be 6, after swapping.", - "testString": "assert(a === 6, 'Value of a should be 6, after swapping.');" + "testString": + "assert(a === 6, 'Value of a should be 6, after swapping.');" }, { "text": "Value of b should be 8, after swapping.", - "testString": "assert(b === 8, 'Value of b should be 8, after swapping.');" + "testString": + "assert(b === 8, 'Value of b should be 8, after swapping.');" }, { "text": "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), '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), 'Use array destructuring to swap a and b.');" } ], "releasedOn": "Feb 17, 2017", @@ -787,7 +856,8 @@ }, { "id": "587d7b8a367417b2b2512b4c", - "title": "Use Destructuring Assignment with the Rest Operator to Reassign Array Elements", + "title": + "Use Destructuring Assignment with the Rest Operator to Reassign Array Elements", "description": [ "In some situations involving array destructuring, we might want to collect the rest of the elements into a separate array.", "The result is similar to Array.prototype.slice(), as shown below:", @@ -800,15 +870,18 @@ "tests": [ { "text": "arr should be [3,4,5,6,7,8,9,10]", - "testString": "assert(arr.every((v, i) => v === i + 3),'arr should be [3,4,5,6,7,8,9,10]');" + "testString": + "assert(arr.every((v, i) => v === i + 3) && arr.length === 8,'arr should be [3,4,5,6,7,8,9,10]');" }, { - "text": "destructuring was used.", - "testString": "getUserInput => assert(getUserInput('index').match(/\\[\\s*\\w*\\s*,\\s*\\w*\\s*,\\s*...arr\\s*\\]/g),'destructuring was used.');" + "text": "Destructuring should be used.", + "testString": + "getUserInput => assert(getUserInput('index').match(/\\[\\s*\\w*\\s*,\\s*\\w*\\s*,\\s*...\\w+\\s*\\]/g),'Destructuring should be used.');" }, { - "text": "Array.slice() was not used.", - "testString": "getUserInput => assert(!getUserInput('index').match(/Array.slice/g), 'Array.slice() was not used.');" + "text": "Array.slice() should not be used.", + "testString": + "getUserInput => assert(!getUserInput('index').match(/slice/g), 'Array.slice() should not be used.');" } ], "releasedOn": "Feb 17, 2017", @@ -839,7 +912,8 @@ }, { "id": "587d7b8a367417b2b2512b4d", - "title": "Use Destructuring Assignment to Pass an Object as a Function's Parameters", + "title": + "Use Destructuring Assignment to Pass an Object as a Function's Parameters", "description": [ "In some cases, you can destructure the object in a function argument itself.", "Consider the code below:", @@ -854,15 +928,18 @@ "tests": [ { "text": "stats should be an object.", - "testString": "assert(typeof stats === 'object', 'stats should be an object.');" + "testString": + "assert(typeof stats === 'object', 'stats should be an object.');" }, { "text": "half(stats) should be 28.015", - "testString": "assert(half(stats) === 28.015, 'half(stats) should be 28.015');" + "testString": + "assert(half(stats) === 28.015, 'half(stats) should be 28.015');" }, { "text": "Destructuring was used.", - "testString": "getUserInput => assert(getUserInput('index').match(/\\(\\s*\\{\\s*\\w+\\s*,\\s*\\w+\\s*\\}\\s*\\)/g), 'Destructuring was used.');" + "testString": + "getUserInput => assert(getUserInput('index').match(/\\(\\s*\\{\\s*\\w+\\s*,\\s*\\w+\\s*\\}\\s*\\)/g), 'Destructuring was used.');" } ], "releasedOn": "Feb 17, 2017", @@ -919,16 +996,20 @@ ], "tests": [ { - "text": "resultDisplayArray is an array containing result failure messages.", - "testString": "assert(typeof makeList(result.failure) === 'object' && resultDisplayArray.length === 3, 'resultDisplayArray is a list containing result failure messages.');" + "text": + "resultDisplayArray is an array containing result failure messages.", + "testString": + "assert(typeof makeList(result.failure) === 'object' && resultDisplayArray.length === 3, 'resultDisplayArray is a list containing result failure messages.');" }, { "text": "resultDisplayArray is the desired output.", - "testString": "assert(makeList(result.failure).every((v, i) => v === `
  • ${result.failure[i]}
  • ` || v === `
  • ${result.failure[i]}
  • `), 'resultDisplayArray is the desired output.');" + "testString": + "assert(makeList(result.failure).every((v, i) => v === `
  • ${result.failure[i]}
  • ` || v === `
  • ${result.failure[i]}
  • `), 'resultDisplayArray is the desired output.');" }, { "text": "Template strings were used", - "testString": "getUserInput => assert(getUserInput('index').match(/`.*`/g), 'Template strings were not used');" + "testString": + "getUserInput => assert(getUserInput('index').match(/`.*`/g), 'Template strings were not used');" } ], "releasedOn": "Feb 17, 2017", @@ -983,12 +1064,15 @@ ], "tests": [ { - "text": "the output is {name: \"Zodiac Hasbro\", age: 56, gender: \"male\"}.", - "testString": "assert(() => {const res={name:\"Zodiac Hasbro\",age:56,gender:\"male\"}; const person=createPerson(\"Zodiac Hasbro\", 56, \"male\"); return Object.keys(person).every(k => person[k] === res[k]);}, 'the output is {name: \"Zodiac Hasbro\", age: 56, gender: \"male\"}.');" + "text": + "the output is {name: \"Zodiac Hasbro\", age: 56, gender: \"male\"}.", + "testString": + "assert(() => {const res={name:\"Zodiac Hasbro\",age:56,gender:\"male\"}; const person=createPerson(\"Zodiac Hasbro\", 56, \"male\"); return Object.keys(person).every(k => person[k] === res[k]);}, 'the output is {name: \"Zodiac Hasbro\", age: 56, gender: \"male\"}.');" }, { "text": "No : were used.", - "testString": "getUserInput => assert(!getUserInput('index').match(/:/g), 'No : were used.');" + "testString": + "getUserInput => assert(!getUserInput('index').match(/:/g), 'No : were used.');" } ], "releasedOn": "Feb 17, 2017", @@ -1031,15 +1115,19 @@ "tests": [ { "text": "Traditional function expression was not used.", - "testString": "assert(!getUserInput('index').match(/function/),'Traditional function expression was not used.');" + "testString": + "assert(!getUserInput('index').match(/function/),'Traditional function expression was not used.');" }, { "text": "setGear is a declarative function.", - "testString": "assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\\s*\\(.+\\)\\s*\\{/), 'setGear is a declarative function.');" + "testString": + "assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\\s*\\(.+\\)\\s*\\{/), 'setGear is a declarative function.');" }, { - "text": "bicycle.setGear(48) changes the gear value to 48.", - "testString": "assert((new bicycle.setGear(48)).gear === 48, 'bicycle.setGear(48) changes the gear value to 48.');" + "text": + "bicycle.setGear(48) changes the gear value to 48.", + "testString": + "assert((new bicycle.setGear(48)).gear === 48, 'bicycle.setGear(48) changes the gear value to 48.');" } ], "releasedOn": "Feb 17, 2017", @@ -1085,20 +1173,25 @@ ], "tests": [ { - "text": "Vegetable should be a class with a defined constructor method.", - "testString": "assert(typeof Vegetable === 'function' && typeof Vegetable.constructor === 'function', 'Vegetable should be a class with a defined constructor method.');" + "text": + "Vegetable should be a class with a defined constructor method.", + "testString": + "assert(typeof Vegetable === 'function' && typeof Vegetable.constructor === 'function', 'Vegetable should be a class with a defined constructor method.');" }, { "text": "class keyword was used.", - "testString": "getUserInput => assert(getUserInput('index').match(/class/g),'class keyword was used.');" + "testString": + "getUserInput => assert(getUserInput('index').match(/class/g),'class keyword was used.');" }, { "text": "Vegetable can be instantiated.", - "testString": "assert(() => {const a = new Vegetable(\"apple\"); return typeof a === 'object';},'Vegetable can be instantiated.');" + "testString": + "assert(() => {const a = new Vegetable(\"apple\"); return typeof a === 'object';},'Vegetable can be instantiated.');" }, { "text": "carrot.name should return carrot.", - "testString": "assert(carrot.name=='carrot','carrot.name should return carrot.');" + "testString": + "assert(carrot.name=='carrot','carrot.name should return carrot.');" } ], "releasedOn": "Feb 17, 2017", @@ -1148,16 +1241,20 @@ ], "tests": [ { - "text": "Thermostat should be a class with a defined constructor method.", - "testString": "assert(typeof Thermostat === 'function' && typeof Thermostat.constructor === 'function','Thermostat should be a class with a defined constructor method.');" + "text": + "Thermostat should be a class with a defined constructor method.", + "testString": + "assert(typeof Thermostat === 'function' && typeof Thermostat.constructor === 'function','Thermostat should be a class with a defined constructor method.');" }, { "text": "class keyword was used.", - "testString": "getUserInput => assert(getUserInput('index').match(/class/g),'class keyword was used.');" + "testString": + "getUserInput => assert(getUserInput('index').match(/class/g),'class keyword was used.');" }, { "text": "Thermostat can be instantiated.", - "testString": "assert(() => {const t = new Thermostat(32); return typeof t === 'object' && t.temperature === 0;}, 'Thermostat can be instantiated.');" + "testString": + "assert(() => {const t = new Thermostat(32); return typeof t === 'object' && t.temperature === 0;}, 'Thermostat can be instantiated.');" } ], "releasedOn": "Feb 17, 2017", @@ -1207,7 +1304,8 @@ "tests": [ { "text": "valid import statement", - "testString": "getUserInput => assert(getUserInput('index').match(/import\\s+\\{\\s*capitalizeString\\s*\\}\\s+from\\s+(\"|')string_functions\\1/g), 'valid import statement');" + "testString": + "getUserInput => assert(getUserInput('index').match(/import\\s+\\{\\s*capitalizeString\\s*\\}\\s+from\\s+(\"|')string_functions\\1/g), 'valid import statement');" } ], "releasedOn": "Feb 17, 2017", @@ -1246,11 +1344,13 @@ "tests": [ { "text": "foo is exported.", - "testString": "getUserInput => assert(getUserInput('index').match(/export\\s+const\\s+foo\\s*=\\s*\"bar\"/g), 'foo is exported.');" + "testString": + "getUserInput => assert(getUserInput('index').match(/export\\s+const\\s+foo\\s*=\\s*\"bar\"/g), 'foo is exported.');" }, { "text": "bar is exported.", - "testString": "getUserInput => assert(getUserInput('index').match(/export\\s+const\\s+bar\\s*=\\s*\"foo\"/g), 'bar is exported.');" + "testString": + "getUserInput => assert(getUserInput('index').match(/export\\s+const\\s+bar\\s*=\\s*\"foo\"/g), 'bar is exported.');" } ], "releasedOn": "Feb 17, 2017", @@ -1287,7 +1387,8 @@ "tests": [ { "text": "Properly uses import * as syntax.", - "testString": "assert(code.match(/import\\s+\\*\\s+as\\s+[a-zA-Z0-9_$]+\\s+from\\s*\"\\s*capitalize_strings\\s*\"\\s*;/gi), 'Properly uses import * as syntax.');" + "testString": + "assert(code.match(/import\\s+\\*\\s+as\\s+[a-zA-Z0-9_$]+\\s+from\\s*\"\\s*capitalize_strings\\s*\"\\s*;/gi), 'Properly uses import * as syntax.');" } ], "releasedOn": "Feb 17, 2017", @@ -1326,7 +1427,8 @@ "tests": [ { "text": "Proper used of export fallback.", - "testString": "getUserInput => assert(getUserInput('index').match(/export\\s+default\\s+function\\s+subtract\\(x,y\\)\\s+{return\\s+x\\s-\\s+y;}/g), 'Proper used of export fallback.');" + "testString": + "getUserInput => assert(getUserInput('index').match(/export\\s+default\\s+function\\s+subtract\\(x,y\\)\\s+{return\\s+x\\s-\\s+y;}/g), 'Proper used of export fallback.');" } ], "releasedOn": "Feb 17, 2017", @@ -1360,7 +1462,8 @@ "tests": [ { "text": "Properly imports export default method.", - "testString": "getUserInput => assert(getUserInput('index').match(/import\\s+subtract\\s+from\\s+\"math_functions\"/g), 'Properly imports export default method.');" + "testString": + "getUserInput => assert(getUserInput('index').match(/import\\s+subtract\\s+from\\s+\"math_functions\"/g), 'Properly imports export default method.');" } ], "releasedOn": "Feb 17, 2017",