From 748a10bc11c5c50bd6975e4c22ef83673bf481f8 Mon Sep 17 00:00:00 2001 From: Mario Pino Date: Fri, 10 Jan 2020 17:11:02 +0100 Subject: [PATCH] Round total rewards to 6 decimal places (#3396) * Round total rewards to 6 decimal places * changelog * Update snaps * Remove async from describe in ActionManager test --- changes/mario_3376-fix-rewards-decimals | 1 + src/ActionModal/components/ModalWithdrawRewards.vue | 4 +++- .../__snapshots__/ModalWithdrawRewards.spec.js.snap | 2 +- .../specs/components/ActionModal/utils/ActionManager.spec.js | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 changes/mario_3376-fix-rewards-decimals diff --git a/changes/mario_3376-fix-rewards-decimals b/changes/mario_3376-fix-rewards-decimals new file mode 100644 index 0000000000..a9130f56a5 --- /dev/null +++ b/changes/mario_3376-fix-rewards-decimals @@ -0,0 +1 @@ +[Fixed] [#3376](https://github.com/cosmos/lunie/issues/3376) Round total rewards to 6 decimal places @mariopino \ No newline at end of file diff --git a/src/ActionModal/components/ModalWithdrawRewards.vue b/src/ActionModal/components/ModalWithdrawRewards.vue index fc033e335e..415977ecec 100644 --- a/src/ActionModal/components/ModalWithdrawRewards.vue +++ b/src/ActionModal/components/ModalWithdrawRewards.vue @@ -63,7 +63,9 @@ export default { } }, totalRewards() { - return this.rewards.reduce((sum, { amount }) => sum + Number(amount), 0) + return this.rewards + .reduce((sum, { amount }) => sum + Number(amount), 0) + .toFixed(6) }, notifyMessage() { return { diff --git a/tests/unit/specs/components/ActionModal/components/__snapshots__/ModalWithdrawRewards.spec.js.snap b/tests/unit/specs/components/ActionModal/components/__snapshots__/ModalWithdrawRewards.spec.js.snap index f0012ba02b..5099c5b65e 100644 --- a/tests/unit/specs/components/ActionModal/components/__snapshots__/ModalWithdrawRewards.spec.js.snap +++ b/tests/unit/specs/components/ActionModal/components/__snapshots__/ModalWithdrawRewards.spec.js.snap @@ -39,7 +39,7 @@ exports[`ModalWithdrawRewards should show the withdraw rewards modal 1`] = ` disabled="disabled" id="amount" type="number" - value="0" + value="0.000000" /> diff --git a/tests/unit/specs/components/ActionModal/utils/ActionManager.spec.js b/tests/unit/specs/components/ActionModal/utils/ActionManager.spec.js index eb4bbf6e3e..525d607cc7 100644 --- a/tests/unit/specs/components/ActionModal/utils/ActionManager.spec.js +++ b/tests/unit/specs/components/ActionModal/utils/ActionManager.spec.js @@ -171,7 +171,7 @@ describe("ActionManager", () => { } }) - describe("simulating and sending", async () => { + describe("simulating and sending", () => { beforeEach(async () => { const context = { url: "blah",