diff --git a/.flowconfig b/.flowconfig index b28be239..a3d33db0 100644 --- a/.flowconfig +++ b/.flowconfig @@ -8,7 +8,7 @@ .*/node_modules/react-router/.* .*/node_modules/react-router-redux/.* .*/_old/.* -.*/src/solidity/.* +.*/public/.* [libs] ./src/flowtype/npm/redux_v3.x.x.js diff --git a/src/utils/__tests__/__snapshots__/formatUtils.test.js.snap b/src/utils/__tests__/__snapshots__/formatUtils.test.js.snap index c9eab582..c7a37e6c 100644 --- a/src/utils/__tests__/__snapshots__/formatUtils.test.js.snap +++ b/src/utils/__tests__/__snapshots__/formatUtils.test.js.snap @@ -12,11 +12,13 @@ exports[`format utils btckb2satoshib 5`] = `99900000`; exports[`format utils formatAmount 1`] = `"0 btc"`; -exports[`format utils formatAmount 2`] = `"5e-9 btc"`; +exports[`format utils formatAmount 2`] = `"10 mBTC"`; -exports[`format utils formatAmount 3`] = `"1e-8 eth"`; +exports[`format utils formatAmount 3`] = `"0.000005 mBTC"`; -exports[`format utils formatAmount 4`] = `"0.00099999 undefined"`; +exports[`format utils formatAmount 4`] = `"1e-8 eth"`; + +exports[`format utils formatAmount 5`] = `"0.00099999 undefined"`; exports[`format utils formatTime 1`] = `"No time estimate"`; @@ -28,15 +30,13 @@ exports[`format utils formatTime 4`] = `"1 hour 40 minutes"`; exports[`format utils formatTime 5`] = `"16 hours 39 minutes"`; -exports[`format utils hexToString 1`] = `""`; - -exports[`format utils hexToString 2`] = `"ªªª"`; +exports[`format utils formatTime 6`] = `"45 minutes"`; -exports[`format utils hexToString 3`] = `""`; +exports[`format utils hexToString 1`] = `"test"`; -exports[`format utils hexToString 4`] = `""`; +exports[`format utils hexToString 2`] = `"0001"`; -exports[`format utils hexToString 5`] = `""`; +exports[`format utils hexToString 3`] = `"test99999"`; exports[`format utils stringToHex 1`] = `"0074006500730074"`; diff --git a/src/utils/__tests__/formatUtils.test.js b/src/utils/__tests__/formatUtils.test.js index b1c01d0a..e2bc4593 100644 --- a/src/utils/__tests__/formatUtils.test.js +++ b/src/utils/__tests__/formatUtils.test.js @@ -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();