From 195129ea3bd2b4d7344d5a3a36ada97aa514fbbe Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Fri, 15 Mar 2019 01:10:38 +0100 Subject: [PATCH] smallest and string format --- app/src/renderer/scripts/num.js | 4 ++-- .../network/__snapshots__/PageNetwork.spec.js.snap | 8 ++++---- .../specs/components/staking/PageValidator.spec.js | 6 +++--- .../staking/__snapshots__/PageValidator.spec.js.snap | 4 ++-- .../transactions/LiStakeTransaction.spec.js | 2 +- .../__snapshots__/LiBankTransaction.spec.js.snap | 8 ++++---- .../__snapshots__/LiGovTransaction.spec.js.snap | 4 ++-- .../__snapshots__/LiStakeTransaction.spec.js.snap | 12 ++++++------ test/unit/specs/components/wallet/LiCoin.spec.js | 2 +- .../wallet/__snapshots__/LiCoin.spec.js.snap | 2 +- test/unit/specs/scripts/num.spec.js | 2 +- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/app/src/renderer/scripts/num.js b/app/src/renderer/scripts/num.js index 86a5b37136..67a68ec82b 100644 --- a/app/src/renderer/scripts/num.js +++ b/app/src/renderer/scripts/num.js @@ -6,10 +6,10 @@ import BigNumber from "bignumber.js" * @module num */ -const SMALLEST = 1e-7 +const SMALLEST = 1e-6 const language = window.navigator.userLanguage || window.navigator.language function full(number = 0) { - return new Intl.NumberFormat(language, { minimumFractionDigits: 7 }) + return new Intl.NumberFormat(language, { minimumFractionDigits: 6 }) .format(number) } function shortNumber(number = 0) { diff --git a/test/unit/specs/components/network/__snapshots__/PageNetwork.spec.js.snap b/test/unit/specs/components/network/__snapshots__/PageNetwork.spec.js.snap index f9cb0bc08c..4e82e66451 100644 --- a/test/unit/specs/components/network/__snapshots__/PageNetwork.spec.js.snap +++ b/test/unit/specs/components/network/__snapshots__/PageNetwork.spec.js.snap @@ -104,7 +104,7 @@ exports[`PageNetwork should display the network page with data and the blocks ta id="loose_tokens" > - 0.0000100 + 0.000010 @@ -124,7 +124,7 @@ exports[`PageNetwork should display the network page with data and the blocks ta id="bonded_tokens" > - 0.0001250 + 0.000125 @@ -288,7 +288,7 @@ exports[`PageNetwork should display the network page with the blocks table in a id="loose_tokens" > - 0.0000100 + 0.000010 @@ -308,7 +308,7 @@ exports[`PageNetwork should display the network page with the blocks table in a id="bonded_tokens" > - 0.0001250 + 0.000125 diff --git a/test/unit/specs/components/staking/PageValidator.spec.js b/test/unit/specs/components/staking/PageValidator.spec.js index 225f134af6..fb58997d24 100644 --- a/test/unit/specs/components/staking/PageValidator.spec.js +++ b/test/unit/specs/components/staking/PageValidator.spec.js @@ -200,7 +200,7 @@ describe(`PageValidator`, () => { const delegationString = PageValidator.computed.myDelegation.call( { bondDenom, myBond } ) - expect(delegationString).toBe(`10.0000000 stake`) + expect(delegationString).toBe(`10.000000 stake`) }) it(`when user doesn't have any delegations`, () => { @@ -232,7 +232,7 @@ describe(`PageValidator`, () => { const rewardsString = PageValidator.computed.rewards.call( { session, bondDenom, distribution, validator } ) - expect(rewardsString).toBe(`100.0000000 stake`) + expect(rewardsString).toBe(`100.000000 stake`) }) it(`when validator rewards are 0`, () => { @@ -246,7 +246,7 @@ describe(`PageValidator`, () => { const rewardsString = PageValidator.computed.rewards.call( { session, bondDenom, distribution, validator } ) - expect(rewardsString).toBe(`0.0000000 stake`) + expect(rewardsString).toBe(`0.000000 stake`) }) it(`when user doesn't have any delegations`, () => { diff --git a/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap index a34fe1beb0..7014784455 100644 --- a/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/PageValidator.spec.js.snap @@ -90,7 +90,7 @@ exports[`PageValidator shows a validator profile information errors signing info
- 0.0000000 STAKE + 0.000000 STAKE
@@ -417,7 +417,7 @@ exports[`PageValidator shows a validator profile information if user has signed
- 0.0000000 STAKE + 0.000000 STAKE
diff --git a/test/unit/specs/components/transactions/LiStakeTransaction.spec.js b/test/unit/specs/components/transactions/LiStakeTransaction.spec.js index 52dba4cf5b..a974cd7a88 100644 --- a/test/unit/specs/components/transactions/LiStakeTransaction.spec.js +++ b/test/unit/specs/components/transactions/LiStakeTransaction.spec.js @@ -80,7 +80,7 @@ describe(`LiStakeTransaction`, () => { propsData.unbondingTime = Date.now() - 1000 wrapper.setProps({ unbondingTime: Date.now() - 1000 }) expect(wrapper.vm.$el).toMatchSnapshot() - expect(wrapper.text()).toContain(`10,000.0000000`) + expect(wrapper.text()).toContain(`10,000.000000`) }) it(`should default to ended if no unbonding delegation is present`, () => { diff --git a/test/unit/specs/components/transactions/__snapshots__/LiBankTransaction.spec.js.snap b/test/unit/specs/components/transactions/__snapshots__/LiBankTransaction.spec.js.snap index 41ee3daded..47668c979f 100644 --- a/test/unit/specs/components/transactions/__snapshots__/LiBankTransaction.spec.js.snap +++ b/test/unit/specs/components/transactions/__snapshots__/LiBankTransaction.spec.js.snap @@ -10,7 +10,7 @@ exports[`LiBankTransaction should show bank transaction when user hasn't signed Sent  - 12,340.0000000 + 12,340.000000 @@ -44,7 +44,7 @@ exports[`LiBankTransaction should show incoming transactions 1`] = ` Received  - 12,340.0000000 + 12,340.000000 @@ -72,7 +72,7 @@ exports[`LiBankTransaction should show outgoing transactions 1`] = ` Sent  - 12,340.0000000 + 12,340.000000 @@ -101,7 +101,7 @@ exports[`LiBankTransaction should show outgoing transactions send to herself 1`] Sent  - 12,340.0000000 + 12,340.000000 diff --git a/test/unit/specs/components/transactions/__snapshots__/LiGovTransaction.spec.js.snap b/test/unit/specs/components/transactions/__snapshots__/LiGovTransaction.spec.js.snap index 32014cc234..061107f282 100644 --- a/test/unit/specs/components/transactions/__snapshots__/LiGovTransaction.spec.js.snap +++ b/test/unit/specs/components/transactions/__snapshots__/LiGovTransaction.spec.js.snap @@ -11,7 +11,7 @@ exports[`LiGovTransaction deposits 1`] = ` Deposit  - 1,000.0000000 + 1,000.000000 @@ -45,7 +45,7 @@ exports[`LiGovTransaction proposals 1`] = ` Submit text proposal  - 1,000.0000000 + 1,000.000000 diff --git a/test/unit/specs/components/transactions/__snapshots__/LiStakeTransaction.spec.js.snap b/test/unit/specs/components/transactions/__snapshots__/LiStakeTransaction.spec.js.snap index 2d268e2599..81de9fe9b8 100644 --- a/test/unit/specs/components/transactions/__snapshots__/LiStakeTransaction.spec.js.snap +++ b/test/unit/specs/components/transactions/__snapshots__/LiStakeTransaction.spec.js.snap @@ -11,7 +11,7 @@ exports[`LiStakeTransaction create validator 1`] = ` Create validator  - 1.0000000 + 1.000000 @@ -45,7 +45,7 @@ exports[`LiStakeTransaction delegations should show delegations 1`] = ` Delegation  - 42,000.0000000 + 42,000.000000 @@ -101,7 +101,7 @@ exports[`LiStakeTransaction redelegations should show redelegations and calculat - 30.0000000 + 30.000000 @@ -147,7 +147,7 @@ exports[`LiStakeTransaction unbonding delegations should default to ended if no - 10,000.0000000 + 10,000.000000 @@ -185,7 +185,7 @@ exports[`LiStakeTransaction unbonding delegations should show unbonding delegati - 10,000.0000000 + 10,000.000000 @@ -223,7 +223,7 @@ exports[`LiStakeTransaction unbonding delegations should show unbondings and cal - 10,000.0000000 + 10,000.000000 diff --git a/test/unit/specs/components/wallet/LiCoin.spec.js b/test/unit/specs/components/wallet/LiCoin.spec.js index fd7fe2ce1d..d942149653 100644 --- a/test/unit/specs/components/wallet/LiCoin.spec.js +++ b/test/unit/specs/components/wallet/LiCoin.spec.js @@ -20,7 +20,7 @@ describe(`LiCoin`, () => { }) it(`should calculate the full amount of the coin`, () => { - expect(wrapper.vm.amount).toEqual(`10,000.0000000`) + expect(wrapper.vm.amount).toEqual(`10,000.000000`) }) it(`should capitalize the coin denomination`, () => { diff --git a/test/unit/specs/components/wallet/__snapshots__/LiCoin.spec.js.snap b/test/unit/specs/components/wallet/__snapshots__/LiCoin.spec.js.snap index fe880644de..054e34259c 100644 --- a/test/unit/specs/components/wallet/__snapshots__/LiCoin.spec.js.snap +++ b/test/unit/specs/components/wallet/__snapshots__/LiCoin.spec.js.snap @@ -35,7 +35,7 @@ exports[`LiCoin has the expected html structure 1`] = ` class="coin-amount" > - 10,000.0000000 + 10,000.000000

diff --git a/test/unit/specs/scripts/num.spec.js b/test/unit/specs/scripts/num.spec.js index 9877436f0d..88560214d5 100644 --- a/test/unit/specs/scripts/num.spec.js +++ b/test/unit/specs/scripts/num.spec.js @@ -2,7 +2,7 @@ import num from "renderer/scripts/num" describe(`number helper`, () => { it(`should format numbers showing many decimals`, () => { - expect(num.full(1001950.123456)).toBe(`1,001,950.1234560`) + expect(num.full(1001950.123456)).toBe(`1,001,950.123456`) }) it(`should format numbers showing many decimals`, () => {