aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/tx-helper-test.js
blob: cc6543c306d06578b14c5e67ee5507d4cd8963f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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')
  })
})