From 36f1c9aeb64ed5416805bd5a621b8e0119c12775 Mon Sep 17 00:00:00 2001 From: dhcodes Date: Mon, 25 Jul 2016 09:57:35 -0500 Subject: [PATCH] improve tests on Basic JS array challenges --- .../basic-javascript.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/seed/challenges/01-front-end-development-certification/basic-javascript.json b/seed/challenges/01-front-end-development-certification/basic-javascript.json index 68f5cd2f3566c4..a3c6780d7293f8 100644 --- a/seed/challenges/01-front-end-development-certification/basic-javascript.json +++ b/seed/challenges/01-front-end-development-certification/basic-javascript.json @@ -1833,7 +1833,7 @@ "var myArray = [[\"John\", 23], [\"cat\", 2]];\nmyArray.push([\"dog\",3]);" ], "tests": [ - "assert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] == 23 && d[2][0] == 'dog' && d[2][1] == 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"John\", 23], [\"cat\", 2], [\"dog\", 3]].');" + "assert((function(d){if(d[2] != undefined && d[0][0] == 'John' && d[0][1] === 23 && d[2][0] == 'dog' && d[2][1] === 3 && d[2].length == 2){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"John\", 23], [\"cat\", 2], [\"dog\", 3]].');" ], "type": "waypoint", "challengeType": 1, @@ -1876,9 +1876,9 @@ "var myArray = [[\"John\", 23], [\"cat\", 2]];\nvar removedFromMyArray = myArray.pop();" ], "tests": [ - "assert((function(d){if(d[0][0] == 'John' && d[0][1] == 23 && d[1] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should only contain [[\"John\", 23]].');", + "assert((function(d){if(d[0][0] == 'John' && d[0][1] === 23 && d[1] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should only contain [[\"John\", 23]].');", "assert(/removedFromMyArray\\s*=\\s*myArray\\s*.\\s*pop\\s*(\\s*)/.test(code), 'message: Use pop() on myArray');", - "assert((function(d){if(d[0] == 'cat' && d[1] == 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray should only contain [\"cat\", 2].');" + "assert((function(d){if(d[0] == 'cat' && d[1] === 2 && d[2] == undefined){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray should only contain [\"cat\", 2].');" ], "type": "waypoint", "challengeType": 1, @@ -1921,8 +1921,8 @@ "var myArray = [[\"John\", 23], [\"dog\", 3]];\n\n// Only change code below this line.\nvar removedFromMyArray = myArray.shift();" ], "tests": [ - "assert((function(d){if(d[0][0] == 'dog' && d[0][1] == 3 && d[1] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"dog\", 3]].');", - "assert((function(d){if(d[0] === 'John' && d[1] === 23 && typeof removedFromMyArray === 'object'){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray should contain [\"John\", 23].');" + "assert((function(d){if(d[0][0] == 'dog' && d[0][1] === 3 && d[1] == undefined){return true;}else{return false;}})(myArray), 'message: myArray should now equal [[\"dog\", 3]].');", + "assert((function(d){if(d[0] == 'John' && d[1] === 23 && typeof removedFromMyArray === 'object'){return true;}else{return false;}})(removedFromMyArray), 'message: removedFromMyArray should contain [\"John\", 23].');" ], "type": "waypoint", "challengeType": 1, @@ -1965,7 +1965,7 @@ "var myArray = [[\"John\", 23], [\"dog\", 3]];\nmyArray.shift();\nmyArray.unshift([\"Paul\", 35]);" ], "tests": [ - "assert((function(d){if(typeof d[0] === \"object\" && d[0][0].toLowerCase() == 'paul' && d[0][1] == 35 && d[1][0] != undefined && d[1][0] == 'dog' && d[1][1] != undefined && d[1][1] == 3){return true;}else{return false;}})(myArray), 'message: myArray should now have [[\"Paul\", 35], [\"dog\", 3]].');" + "assert((function(d){if(typeof d[0] === \"object\" && d[0][0] == 'Paul' && d[0][1] === 35 && d[1][0] != undefined && d[1][0] == 'dog' && d[1][1] != undefined && d[1][1] == 3){return true;}else{return false;}})(myArray), 'message: myArray should now have [[\"Paul\", 35], [\"dog\", 3]].');" ], "type": "waypoint", "challengeType": 1,