2020-04-20 17:01:00 +02:00
|
|
|
import { strict as assert } from 'assert'
|
2020-01-09 04:34:58 +01:00
|
|
|
import txHelper from '../../../../../ui/lib/tx-helper'
|
2017-07-17 23:16:39 +02:00
|
|
|
|
|
|
|
describe('txHelper', function () {
|
|
|
|
it('always shows the oldest tx first', function () {
|
2020-07-08 23:05:09 +02:00
|
|
|
const metamaskNetworkId = '1'
|
2017-07-17 23:16:39 +02:00
|
|
|
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')
|
|
|
|
})
|
|
|
|
})
|