test-machinepack
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "test-machinepack", | ||
"author": "Mike McNeil <@mikermcneil>", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Raw test runner for machinepacks (also includes a simple stub test driver)", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -54,2 +54,14 @@ /** | ||
// If configured input value is a string, but the machine is NOT expecting | ||
// a string specifically, then attempt to parse. | ||
var isExpectingString = (rttc.infer(inputDef.example) === 'string'); | ||
if (_.isString(valToUse) && !isExpectingString) { | ||
try { | ||
valToUse = JSON.parse(valToUse); | ||
} | ||
catch (e) { | ||
// If parsing fails, then just pass the string straight through. | ||
} | ||
} | ||
memo.push({ | ||
@@ -125,2 +137,16 @@ name: inputName, | ||
outputAssertion = rttc.dehydrate(outputAssertion, typeSchema); | ||
// If output assertion is a string, but the machine is NOT expecting | ||
// a string specifically, then attempt to parse the output assertion | ||
// before performing the check. | ||
var isExpectingString = (typeSchema === 'string'); | ||
if (_.isString(outputAssertion) && !isExpectingString) { | ||
try { | ||
outputAssertion = JSON.parse(outputAssertion); | ||
} | ||
catch (e) { | ||
// If parsing fails, then just pass the original output assertion | ||
// straight through. | ||
} | ||
} | ||
} | ||
@@ -127,0 +153,0 @@ } |
21522
381