Improvements and basic tests for Magic op and addition of deep cloning for dishes

This commit is contained in:
n1474335 2018-08-09 19:17:24 +01:00
parent 2b6c280858
commit 9b7f4e824a
10 changed files with 197 additions and 18 deletions

View file

@ -66,11 +66,15 @@ import Chef from "../src/core/Chef";
ret.output = "Expected an error but did not receive one.";
} else if (result.result === test.expectedOutput) {
ret.status = "passing";
} else if (test.hasOwnProperty("expectedMatch") && test.expectedMatch.test(result.result)) {
ret.status = "passing";
} else {
ret.status = "failing";
const expected = test.expectedOutput ? test.expectedOutput :
test.expectedMatch ? test.expectedMatch.toString() : "unknown";
ret.output = [
"Expected",
"\t" + test.expectedOutput.replace(/\n/g, "\n\t"),
"\t" + expected.replace(/\n/g, "\n\t"),
"Received",
"\t" + result.result.replace(/\n/g, "\n\t"),
].join("\n");