diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2018-06-08 10:52:13 +0200 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2018-06-08 10:52:13 +0200 |
commit | 03fde8bec4c67016ad7ab512d46f8e6448a9ca4d (patch) | |
tree | b9e01f30c47033036e46188a087dc939a4cf018b | |
parent | cb36375d76aeb78699a0f0843cfcd7c9cdf714e1 (diff) | |
download | backoffice-03fde8bec4c67016ad7ab512d46f8e6448a9ca4d.tar.gz backoffice-03fde8bec4c67016ad7ab512d46f8e6448a9ca4d.tar.bz2 backoffice-03fde8bec4c67016ad7ab512d46f8e6448a9ca4d.zip |
JS tests.
Another mock was needed, plus API change fixed.
-rw-r--r-- | js/backoffice.js | 6 | ||||
-rw-r--r-- | js/test/main.js | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/js/backoffice.js b/js/backoffice.js index 5ae68e0..646c33b 100644 --- a/js/backoffice.js +++ b/js/backoffice.js @@ -536,20 +536,17 @@ function get_instance(){ * Remove tracks from the main page table, but * do NOT remove the table headers; it hides them though. */ -function clear_results(){ +var clear_results = function(){ var table = document.getElementById("history"); var tbody = xpath_get("tbody", table).snapshotItem(0); var tbody_children = xpath_get("tbody/*[position() > 1]", table); for(var i=0; i<tbody_children.snapshotLength; i++){ tbody.removeChild(tbody_children.snapshotItem(i)); } - xpath_get("tr[@class='headers']", tbody) .snapshotItem(0).style.visibility = "hidden"; - } - /** * Make the instance selected effective. In particular, it * triggers history retrieval for it. @@ -648,4 +645,5 @@ document.onkeydown = function(e) { if (typeof(module) != "undefined"){ module.exports.track_transfer = track_transfer; module.exports.track_order = track_order; + clear_results = ()=>true; } diff --git a/js/test/main.js b/js/test/main.js index 29d6da7..0a8505f 100644 --- a/js/test/main.js +++ b/js/test/main.js @@ -78,8 +78,11 @@ ava.test("Tracking a wire transfer", (t) => { t.context.requests[0].respond(200, "application/json", JSON.stringify(mock_tracks)); sinon.assert.calledWith - (cb, true, mock_tracks.deposits_sums, - mock_tracks.execution_time, "mock-wtid"); + (cb, + mock_tracks.deposits_sums, + mock_tracks.execution_time, + "mock-wtid"); + t.pass(); }); |