From 089b9a76df9d1faded6e52e683ed6bba09f24e59 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Thu, 3 Sep 2020 09:55:45 +0200 Subject: [PATCH] displaying expected vs received values for unit testing test case --- apps/remix-ide/src/app/tabs/test-tab.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index a57e9af24b..4c84777fab 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -144,24 +144,28 @@ module.exports = class TestTab extends ViewPlugin { this.testsOutput.appendChild(this.outputHeader) } else if (result.type === 'testPass') { this.testsOutput.appendChild(yo` -
+
✓ ${result.value}
`) } else if (result.type === 'testFailure') { + const preposition = result.assertMethod === 'equal' || result.assertMethod === 'notEqual' ? 'to' : '' + const method = result.assertMethod === 'ok' ? '' : result.assertMethod + const expected = result.assertMethod === 'ok' ? `'true'` : result.expected this.testsOutput.appendChild(yo` -
+
✘ ${result.value} Error Message: "${result.errMsg}" Asserttion:
- The value should be
-
'${result.assertMethod}'
-
(to): ${result.expected}
+ Expected value should be +
${method}
+
${preposition} ${expected}
- The result is: - ${result.returned} + Received value: + ${result.returned} + Skipping the rest...
`) }