2021-03-01 16:15:42 +01:00
|
|
|
import {
|
|
|
|
MAINNET_CHAIN_ID,
|
|
|
|
MAINNET_NETWORK_ID,
|
2021-04-28 21:53:59 +02:00
|
|
|
} from '../../../shared/constants/network';
|
2021-03-16 22:00:08 +01:00
|
|
|
import txHelper from './tx-helper';
|
2017-07-17 23:16:39 +02:00
|
|
|
|
2021-04-15 20:01:46 +02:00
|
|
|
describe('txHelper', () => {
|
|
|
|
it('always shows the oldest tx first', () => {
|
2021-03-01 16:15:42 +01:00
|
|
|
const metamaskNetworkId = MAINNET_NETWORK_ID;
|
|
|
|
const chainId = MAINNET_CHAIN_ID;
|
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-03-01 16:15:42 +01:00
|
|
|
const sorted = txHelper(txs, null, null, metamaskNetworkId, chainId);
|
2021-04-15 20:01:46 +02:00
|
|
|
expect(sorted[0].time).toStrictEqual(1);
|
|
|
|
expect(sorted[2].time).toStrictEqual(3);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|