From 2e089816039342aa06eb0d186b6882913628ac10 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Fri, 23 Sep 2016 10:01:48 -0700 Subject: [PATCH] Feat(challenges): Let tests be objects --- common/app/routes/challenges/utils.js | 13 +++++++++---- .../html5-and-css.json | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/common/app/routes/challenges/utils.js b/common/app/routes/challenges/utils.js index 414ea6b6eb..1743c52d08 100644 --- a/common/app/routes/challenges/utils.js +++ b/common/app/routes/challenges/utils.js @@ -35,10 +35,15 @@ export function getFileKey({ challengeType }) { export function createTests({ tests = [] }) { return tests - .map(test => ({ - text: ('' + test).split('message: ').pop().replace(/\'\);/g, ''), - testString: test - })); + .map(test => { + if (typeof tests === 'string') { + return { + text: ('' + test).split('message: ').pop().replace(/\'\);/g, ''), + testString: test + }; + } + return test; + }); } export function loggerToStr(args) { diff --git a/seed/challenges/01-front-end-development-certification/html5-and-css.json b/seed/challenges/01-front-end-development-certification/html5-and-css.json index dc697a898e..3ad2ac7e59 100644 --- a/seed/challenges/01-front-end-development-certification/html5-and-css.json +++ b/seed/challenges/01-front-end-development-certification/html5-and-css.json @@ -24,7 +24,10 @@ "

Hello

" ], "tests": [ - "assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), 'message: Your h1 element should have the text \"Hello World\".');" + { + "text": "Your h1 element should have the text \"Hello World\".');", + "testString": "assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), 'Your h1 element should have the text \"Hello World\".');" + } ], "type": "waypoint", "challengeType": 0,