mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-21 17:37:01 +01:00
Fix for error during sending to multisig address (#17651)
This commit is contained in:
parent
10be6fcfeb
commit
6b64572f8d
@ -537,5 +537,29 @@ describe('Numeric', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('round', () => {
|
||||||
|
it('should return number rounded', () => {
|
||||||
|
expect(new Numeric(10.4375, 10).round()).toEqual(
|
||||||
|
new Numeric(10.4375, 10),
|
||||||
|
);
|
||||||
|
expect(new Numeric(10.4375, 10).round(0)).toEqual(new Numeric(10, 10));
|
||||||
|
expect(new Numeric(10.4375, 10).round(1)).toEqual(
|
||||||
|
new Numeric(10.4, 10),
|
||||||
|
);
|
||||||
|
expect(new Numeric(10.4375, 10).round(2)).toEqual(
|
||||||
|
new Numeric(10.44, 10),
|
||||||
|
);
|
||||||
|
expect(new Numeric(10.4375, 10).round(3)).toEqual(
|
||||||
|
new Numeric(10.437, 10),
|
||||||
|
);
|
||||||
|
expect(new Numeric(10.4375, 10).round(4)).toEqual(
|
||||||
|
new Numeric(10.4375, 10),
|
||||||
|
);
|
||||||
|
expect(new Numeric(10.4375, 10).round(5)).toEqual(
|
||||||
|
new Numeric(10.4375, 10),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -434,7 +434,7 @@ export class Numeric {
|
|||||||
numberOfDecimals?: number,
|
numberOfDecimals?: number,
|
||||||
roundingMode: number = BigNumber.ROUND_HALF_DOWN,
|
roundingMode: number = BigNumber.ROUND_HALF_DOWN,
|
||||||
) {
|
) {
|
||||||
if (numberOfDecimals) {
|
if (typeof numberOfDecimals === 'number') {
|
||||||
return new Numeric(
|
return new Numeric(
|
||||||
this.value.round(numberOfDecimals, roundingMode),
|
this.value.round(numberOfDecimals, roundingMode),
|
||||||
this.base,
|
this.base,
|
||||||
|
Loading…
Reference in New Issue
Block a user