1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-12 20:57:12 +01:00
metamask-extension/test/unit/app/controllers/transactions/tx-helper.test.js
Thomas Huang 3ba91df387
Unifies unit tests filename suffix to .test.js (#10607)
* Unifies the filename suffix to .test.js

* Display @babel/no-invalid-this rule for tx-controller.test.js

* Add test file extension to test:unit:global
2021-03-09 11:08:06 -08:00

23 lines
723 B
JavaScript

import { strict as assert } from 'assert';
import {
MAINNET_CHAIN_ID,
MAINNET_NETWORK_ID,
} from '../../../../../shared/constants/network';
import txHelper from '../../../../../ui/lib/tx-helper';
describe('txHelper', function () {
it('always shows the oldest tx first', function () {
const metamaskNetworkId = MAINNET_NETWORK_ID;
const chainId = MAINNET_CHAIN_ID;
const txs = {
a: { metamaskNetworkId, time: 3 },
b: { metamaskNetworkId, time: 1 },
c: { metamaskNetworkId, time: 2 },
};
const sorted = txHelper(txs, null, null, metamaskNetworkId, chainId);
assert.equal(sorted[0].time, 1, 'oldest tx first');
assert.equal(sorted[2].time, 3, 'newest tx last');
});
});