diff --git a/tools/src/tester/ChapterEvaluator.ts b/tools/src/tester/ChapterEvaluator.ts index db0f8bafd..1cb4a1723 100644 --- a/tools/src/tester/ChapterEvaluator.ts +++ b/tools/src/tester/ChapterEvaluator.ts @@ -86,15 +86,14 @@ export default class ChapterEvaluator { #evaluate_payload_body(response: ActualResponse, expected_payload?: Payload): Evaluation { if (expected_payload == null) return { result: Result.PASSED } const delta = atomizeChangeset(diff(expected_payload, response.payload)) - var messages: string[] = [] - delta.forEach((value, _index, _array) => { + var messages: string[] = _.compact(delta.map((value, _index, _array) => { switch(value.type) { case Operation.UPDATE: - return messages.push(`expected ${value.path.replace('$.', '')}='${value.oldValue}', got '${value.value}'`) + return `expected ${value.path.replace('$.', '')}='${value.oldValue}', got '${value.value}'` case Operation.REMOVE: - return messages.push(`missing ${value.path.replace('$.', '')}='${value.value}'`) + return `missing ${value.path.replace('$.', '')}='${value.value}'` } - }) + })) return messages.length > 0 ? { result: Result.FAILED, message: _.join(messages, ', ')} : { result: Result.PASSED } }