From 614501e743a0c1584062c78a25e6b9a3ddf10aab Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 17 Jul 2017 14:16:39 -0700 Subject: 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 --- test/unit/tx-helper-test.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/unit/tx-helper-test.js (limited to 'test') 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') + }) +}) -- cgit v1.2.3