From 667dba93b4bd3f22b23a955959de480c7d5ad048 Mon Sep 17 00:00:00 2001 From: Pushpender Maan Date: Mon, 16 Jul 2018 07:03:41 +0530 Subject: [PATCH] fix(challenges): fix broken tests - es6_declarative_function --- .../es6.json | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/challenges/02-javascript-algorithms-and-data-structures/es6.json b/challenges/02-javascript-algorithms-and-data-structures/es6.json index 4f92d7361..693745ac6 100644 --- a/challenges/02-javascript-algorithms-and-data-structures/es6.json +++ b/challenges/02-javascript-algorithms-and-data-structures/es6.json @@ -1120,15 +1120,20 @@ ], "tests": [ { - "text": - "setGear is a function and changes the gear variable.", + "text": "Traditional function expression was not used.", "testString": - "assert(() => { bicycle.setGear(48); return bicycle.gear === 48 }, 'setGear is a function and changes the gear variable.');" + "assert(!getUserInput('index').match(/function/),'Traditional function expression was not used.');" }, { - "text": "Declarative function was used.", + "text": "setGear is a declarative function.", + "testString": + "assert(typeof bicycle.setGear === 'function' && getUserInput('index').match(/setGear\\s*\\(.+\\)\\s*\\{/), 'setGear is a declarative function.');" + }, + { + "text": + "bicycle.setGear(48) changes the gear value to 48.", "testString": - "getUserInput => assert(!getUserInput('index').match(/:\\s*function\\s*\\(\\)/g), 'Declarative function was used.');" + "assert((new bicycle.setGear(48)).gear === 48, 'bicycle.setGear(48) changes the gear value to 48.');" } ], "releasedOn": "Feb 17, 2017",