2021-02-04 19:15:23 +01:00
|
|
|
import { strict as assert } from 'assert';
|
|
|
|
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 () {
|
2021-02-04 19:15:23 +01: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 },
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2017-07-17 23:16:39 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|