aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/tx-helper-test.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-07-18 05:16:39 +0800
committerDan Finlay <dan@danfinlay.com>2017-07-18 05:18:00 +0800
commit614501e743a0c1584062c78a25e6b9a3ddf10aab (patch)
treeaba81e5cf7b3ca9f0ef79605345d9406ac7a26e3 /test/unit/tx-helper-test.js
parent919f3c46015bcf39be7efd13d84cb24c8be5c939 (diff)
downloadtangerine-wallet-browser-614501e743a0c1584062c78a25e6b9a3ddf10aab.tar
tangerine-wallet-browser-614501e743a0c1584062c78a25e6b9a3ddf10aab.tar.gz
tangerine-wallet-browser-614501e743a0c1584062c78a25e6b9a3ddf10aab.tar.bz2
tangerine-wallet-browser-614501e743a0c1584062c78a25e6b9a3ddf10aab.tar.lz
tangerine-wallet-browser-614501e743a0c1584062c78a25e6b9a3ddf10aab.tar.xz
tangerine-wallet-browser-614501e743a0c1584062c78a25e6b9a3ddf10aab.tar.zst
tangerine-wallet-browser-614501e743a0c1584062c78a25e6b9a3ddf10aab.zip
Fix transaction confirmation ordering
Newest tx or message will now always appear last, and a new tx proposed after the user has a confirmation box open will never change the confirmation to a different tx proposed. Fixes #1637
Diffstat (limited to 'test/unit/tx-helper-test.js')
-rw-r--r--test/unit/tx-helper-test.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit/tx-helper-test.js b/test/unit/tx-helper-test.js
new file mode 100644
index 000000000..cc6543c30
--- /dev/null
+++ b/test/unit/tx-helper-test.js
@@ -0,0 +1,17 @@
+const assert = require('assert')
+const txHelper = require('../../ui/lib/tx-helper')
+
+describe('txHelper', function () {
+ it('always shows the oldest tx first', function () {
+ const metamaskNetworkId = 1
+ const txs = {
+ a: { metamaskNetworkId, time: 3 },
+ b: { metamaskNetworkId, time: 1 },
+ c: { metamaskNetworkId, time: 2 },
+ }
+
+ const sorted = txHelper(txs, null, null, metamaskNetworkId)
+ assert.equal(sorted[0].time, 1, 'oldest tx first')
+ assert.equal(sorted[2].time, 3, 'newest tx last')
+ })
+})