Package: Validate challenges on test (#17216)

This PR allows us to validate the schema during test.

It also removes some cruft from the seed files and ensures only the required data is packaged and consumable, reducing the package weight somewhat.
This commit is contained in:
Stuart Taylor
2018-05-22 13:43:14 +01:00
committed by mrugesh mohapatra
parent 1ccaf255a6
commit 8535669ea4
51 changed files with 49 additions and 1377 deletions

View File

@@ -38,7 +38,6 @@
"testString": "assert(yourArray.filter( el => typeof el === 'string').length >= 1, '<code>yourArray</code> contains at least one <code>string</code>');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -91,7 +90,6 @@
"testString": "assert.strictEqual(myArray[3], \"d\", '<code>myArray[3]</code> is equal to <code>\"d\"</code>');"
}
],
"type": "waypoint",
"solutions": [],
"challengeType": 1,
"translations": {},
@@ -137,7 +135,6 @@
"testString": "assert.notStrictEqual(mixedNumbers.toString().search(/\\.unshift\\(/), -1, 'The <code>mixedNumbers</code> function should utilize the <code>unshift()</code> method');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -189,7 +186,6 @@
"testString": "assert.notStrictEqual(popShift.toString().search(/\\.shift\\(/), -1, 'The <code>popShift</code> function should utilize the <code>shift()</code> method');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -236,7 +232,6 @@
"testString": "assert.notStrictEqual(sumOfTen.toString().search(/\\.splice\\(/), -1, 'The <code>sumOfTen</code> function should utilize the <code>splice()</code> method');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -290,7 +285,6 @@
"testString": "assert(!/\\[\\d\\]\\s*=/.test(code), 'You should not use array bracket notation.');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -336,7 +330,6 @@
"testString": "assert(/\\.slice\\(/.test(code), 'The <code>forecast</code> function should utilize the <code>slice()</code> method');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -393,7 +386,6 @@
"testString": "assert.notStrictEqual(copyMachine.toString().indexOf('.concat(_toConsumableArray(arr))'), -1, 'The <code>copyMachine</code> function should utilize the <code>spread operator</code> with array <code>arr</code>');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -443,7 +435,6 @@
"testString": "assert.notStrictEqual(spreadOut.toString().search(/[...]/), -1, 'The <code>spreadOut</code> function should utilize spread syntax');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -500,7 +491,6 @@
"testString": "assert.notStrictEqual(quickCheck.toString().search(/\\.indexOf\\(/), -1, 'The <code>quickCheck</code> function should utilize the <code>indexOf()</code> method');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -558,7 +548,6 @@
"testString": "assert.notStrictEqual(filteredArray.toString().search(/for/), -1, 'The <code>filteredArray</code> function should utilize a <code>for</code> loop');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -622,7 +611,6 @@
"testString": "assert((function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, 'deepest').length === 1 && (function howDeep(array, target, depth = 0) {return array.reduce((combined, current) => {if (Array.isArray(current)) { return combined.concat(howDeep(current, target, depth + 1));} else if (current === target) { return combined.concat(depth);} else { return combined;}}, []);})(myNestedArray, 'deepest')[0] === 4, '<code>myNestedArray</code> should contain exactly one occurrence of the string <code>\"deepest\"</code> on an array nested 5 levels deep');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -684,7 +672,6 @@
"testString": "assert(code.search(/bananas:/) === -1 && code.search(/grapes:/) === -1 && code.search(/strawberries:/) === -1, 'The key-value pairs should be set using dot or bracket notation');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -740,7 +727,6 @@
"testString": "assert.strictEqual(code.search(/online: 45/), -1, 'The <code>online</code> property is set using dot or bracket notation');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -803,7 +789,6 @@
"testString": "assert.strictEqual(checkInventory('strawberries'), 27, '<code>checkInventory(\"strawberries\")</code> should return <code>27</code>');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -858,7 +843,6 @@
"testString": "assert(code.search(/oranges:/) !== -1 && code.search(/plums:/) !== -1 && code.search(/strawberries:/) !== -1, 'The <code>oranges</code>, <code>plums</code>, and <code>strawberries</code> keys are removed using <code>delete</code>');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -912,7 +896,6 @@
"testString": "assert((function() { delete users.Alan; delete users.Jeff; delete users.Sarah; delete users.Ryan; return isEveryoneHere(users) })() === false, 'The function <code>isEveryoneHere</code> returns <code>false</code> if <code>Alan</code>, <code>Jeff</code>, <code>Sarah</code>, and <code>Ryan</code> are not properties on the <code>users</code> object');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -976,7 +959,6 @@
"testString": "assert((function() { users.Harry = {online: true}; users.Sam = {online: true}; users.Carl = {online: true}; return countOnline(users) })() === 5, 'The function <code>countOnline</code> returns the number of users with the <code>online</code> property set to <code>true</code>');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -1037,7 +1019,6 @@
"testString": "assert((function() { users.Sam = {}; users.Lewis = {}; let R = getArrayOfUsers(users); return (R.indexOf('Alan') !== -1 && R.indexOf('Jeff') !== -1 && R.indexOf('Sarah') !== -1 && R.indexOf('Ryan') !== -1 && R.indexOf('Sam') !== -1 && R.indexOf('Lewis') !== -1); })() === true, 'The <code>getArrayOfUsers</code> function returns an array which contains all the keys in the <code>users</code> object');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,
@@ -1102,7 +1083,6 @@
"testString": "assert.deepEqual((function() { delete user.data.friends; user.data.friends = ['Sam', 'Kira', 'Tomo']; return addFriend(user, 'Pete') })(), ['Sam', 'Kira', 'Tomo', 'Pete'], '<code>addFriend(user, \"Pete\")</code> should return <code>[\"Sam\", \"Kira\", \"Tomo\", \"Pete\"]</code>');"
}
],
"type": "waypoint",
"releasedOn": "Feb 17, 2017",
"solutions": [],
"challengeType": 1,