From 525ea6731432e6d98f38e96013029482ace3571c 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/challenges/03-back-end-development-certification/automated-testing-and-debugging.json b/challenges/03-back-end-development-certification/automated-testing-and-debugging.json index 51ed5033288..90e38c5139c 100644 --- a/challenges/03-back-end-development-certification/automated-testing-and-debugging.json +++ b/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":[ "",