Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffmabc committed Jul 7, 2020
1 parent 8e91114 commit 1a63514
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions js/utils/currency.js
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,20 @@ export function validateCurrencyAmount(amount, divisibility, options = {}) {
returnVal.validRequired = true;

const bigNum = bigNumber(amount);
console.log(amount);

if (
(
opts.requireBigNumAmount &&
!(amount instanceof bigNumber)
) ||
(bigNum.isNaN())
) {
returnVal.validType = false;
return returnVal;
}

returnVal.validType = true;

switch (opts.rangeType) {
case CUR_VAL_RANGE_TYPES.GREATER_THAN_ZERO:
Expand Down
6 changes: 6 additions & 0 deletions js/views/components/moderators/Moderators.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import baseVw from '../../baseVw';
import { openSimpleMessage } from '../../modals/SimpleMessage';
import ModCard from './Card';
import ModeratorsStatus from './Status';
import bigNumber from "bignumber.js";

export default class extends baseVw {
/**
Expand Down Expand Up @@ -153,6 +154,11 @@ export default class extends baseVw {
const modCurs = data.moderatorInfo && data.moderatorInfo.acceptedCurrencies || [];
const supportedCur = anySupportedByWallet(modCurs);

if(data.moderatorInfo.fee.feeType == "FIXED_PLUS_PERCENTAGE" &&
!(data.moderatorInfo.fee.fixedFee.amount instanceof bigNumber) ) {
data.moderatorInfo.fee.fixedFee.amount = bigNumber(data.moderatorInfo.fee.fixedFee.amount);
}

if ((!!isAMod && supportedCur || this.options.showInvalid)) {
const newMod = new Moderator(data, { parse: true });
if (newMod.isValid()) this.moderatorsCol.add(newMod);
Expand Down

0 comments on commit 1a63514

Please sign in to comment.