From 9b0673ea1efd4983530a1e1b64ca687fc6be2915 Mon Sep 17 00:00:00 2001 From: Robert Richey Date: Thu, 31 Dec 2015 09:01:40 -0700 Subject: [PATCH] Fix tests on Waypoint: Using typeof Tests are now more robust. typeof string accepts any string - empty or not - with either single or double quotes. typeof number accepts any number, including floating point. Refactored from editor.getValue().match to code.match() and removed flags gi, as they don't make sense in these tests. closes #5065 --- .../automated-testing-and-debugging.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json b/seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json index 51ed503328..90e38c5139 100644 --- a/seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json +++ b/seed/challenges/03-back-end-development-certification/automated-testing-and-debugging.json @@ -53,10 +53,10 @@ "console.log(typeof {});" ], "tests":[ - "assert(editor.getValue().match(/console\\.log\\(typeof[\\( ]\"\"\\)?\\);/gi), 'message: You should console.log the typeof a string.');", - "assert(editor.getValue().match(/console\\.log\\(typeof[\\( ]0\\)?\\);/gi), 'message: You should console.log the typeof a number.');", - "assert(editor.getValue().match(/console\\.log\\(typeof[\\( ]\\[\\]\\)?\\);/gi), 'message: You should console.log the typeof an array.');", - "assert(editor.getValue().match(/console\\.log\\(typeof[\\( ]\\{\\}\\)?\\);/gi), 'message: You should console.log the typeof a object.');" + "assert(code.match(/console\\.log\\(typeof[\\( ][\"'].*[\"']\\)?\\);/), 'message: You should console.log the typeof a string.');", + "assert(code.match(/console\\.log\\(typeof[\\( ]\\d+\\.?\\d*\\)?\\);/), 'message: You should console.log the typeof a number.');", + "assert(code.match(/console\\.log\\(typeof[\\( ]\\[\\]\\)?\\);/), 'message: You should console.log the typeof an array.');", + "assert(code.match(/console\\.log\\(typeof[\\( ]\\{\\}\\)?\\);/), 'message: You should console.log the typeof a object.');" ], "challengeSeed":[ "",