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",