2022-09-14 16:55:31 +02:00
|
|
|
import { CHAIN_IDS, NETWORK_IDS } 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', () => {
|
2022-09-14 16:55:31 +02:00
|
|
|
const metamaskNetworkId = NETWORK_IDS.MAINNET;
|
|
|
|
const chainId = CHAIN_IDS.MAINNET;
|
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
|
|
|
|
2023-01-31 13:01:10 +01:00
|
|
|
const sorted = txHelper(
|
|
|
|
txs,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|