Using JsUnit, I am trying to make use of the assertEquals
function, such that when a suite of tests fail, they will print useful information as to why they failed.
My current situation is such:
let actual = some_method_call ();
let expected = [
{num: 1, file: f, id: "apples"},
{num: 6, file: f, id: "bananas"},
{num: 9, file: f, id: "accurate_comparison"}
];
assertEquals (expected, actual);
Unfortunately, iterating through the exception leaves me with only:
isJsUnitException: true
comment: null
jsUnitMessage: Expected [object Object],[object Object],[object Object] (object) but was 42 (number)
stackTrace: > JsUnitException:307
> _assert:113
> assertEquals:150
> testStealBitcoins:105
> anonymous:159
How can I get the Expected line to intelligently display the contents of my objects that are expected? Any solution would need to be applicable to various layers of nested objects. Also, is this the wrong way to approach failing test-debugging?