1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-01-08 07:01:04 +00:00

Format utils tests refactored 2

This commit is contained in:
Vladimir Volek 2019-02-25 15:08:09 +01:00
parent ced81e5503
commit be3efd1835

View File

@ -1,12 +1,13 @@
import * as utils from '../formatUtils';
describe('format utils', () => {
// TODO: check this weird function
it('formatAmount', () => {
expect(utils.formatAmount(0, { isBitcoin: true }, 'mbtc')).toMatchSnapshot('0 btc');
expect(utils.formatAmount(1000000, { isBitcoin: true }, 'mbtc')).toMatchSnapshot('10 mBTC');
expect(utils.formatAmount(0.5, { isBitcoin: true }, 'mbtc')).toMatchSnapshot('0.000005 mBTC');
expect(utils.formatAmount(1, { isBitcoin: false, shortcut: 'eth' }, null)).toMatchSnapshot('1e-8 eth');
expect(utils.formatAmount(99999, { isBitcoin: false, shortcut: 'tau' }, null)).toMatchSnapshot('0.00099999 tau');
expect(utils.formatAmount(0, { isBitcoin: false, shortcut: 'mbtc' }, 'mbtc')).toBe('0 mbtc');
expect(utils.formatAmount(1000000, { isBitcoin: true }, 'mbtc')).toBe('10 mBTC');
expect(utils.formatAmount(0.5, { isBitcoin: true }, 'mbtc')).toBe('0.000005 mBTC');
expect(utils.formatAmount(1, { isBitcoin: false, shortcut: 'eth' }, null)).toBe('1e-8 eth');
expect(utils.formatAmount(99999, { isBitcoin: false, shortcut: 'tau' }, null)).toBe('0.00099999 tau');
});
it('format time', () => {