|
|
|
@ -4,18 +4,19 @@ describe('format utils', () => {
|
|
|
|
|
it('formatAmount', () => {
|
|
|
|
|
const input = [
|
|
|
|
|
{ amount: 0, coinInfo: { isBitcoin: true, currencyUnits: 'mbtc', shortcut: 'btc' } },
|
|
|
|
|
{ amount: 1000000, coinInfo: { isBitcoin: true, currencyUnits: 'mbtc', shortcut: 'btc' } },
|
|
|
|
|
{ amount: 0.5, coinInfo: { isBitcoin: true, currencyUnits: 'mbtc', shortcut: 'btc' } },
|
|
|
|
|
{ amount: 1, coinInfo: { isBitcoin: false, shortcut: 'eth' } },
|
|
|
|
|
{ amount: 99999, coinInfo: { isBitcoin: false, currencyUnits: 'tau' } },
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
input.forEach((entry) => {
|
|
|
|
|
expect(formatUtils.formatAmount(entry.amount, entry.coinInfo)).toMatchSnapshot();
|
|
|
|
|
expect(formatUtils.formatAmount(entry.amount, entry.coinInfo, entry.coinInfo.currencyUnits)).toMatchSnapshot();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('formatTime', () => {
|
|
|
|
|
const input = [0, 1, 2, 100, 999];
|
|
|
|
|
const input = [0, 1, 2, 100, 999, 45];
|
|
|
|
|
|
|
|
|
|
input.forEach((entry) => {
|
|
|
|
|
expect(formatUtils.formatTime(entry)).toMatchSnapshot();
|
|
|
|
@ -39,7 +40,7 @@ describe('format utils', () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('hexToString', () => {
|
|
|
|
|
const input = [0, 'xxxtestSringtestStringaaaaaa', 30303031, 2746573743939393939, -9];
|
|
|
|
|
const input = ['0074006500730074', '0030003000300031', '007400650073007400390039003900390039'];
|
|
|
|
|
|
|
|
|
|
input.forEach((entry) => {
|
|
|
|
|
expect(formatUtils.hexToString(entry)).toMatchSnapshot();
|
|
|
|
|