1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00

Fix for error during sending to multisig address (#17651)

This commit is contained in:
Olusegun Akintayo 2023-02-09 17:49:39 +01:00 committed by GitHub
parent 10be6fcfeb
commit 6b64572f8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View File

@ -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),
);
});
});
});
});

View File

@ -434,7 +434,7 @@ export class Numeric {
numberOfDecimals?: number,
roundingMode: number = BigNumber.ROUND_HALF_DOWN,
) {
if (numberOfDecimals) {
if (typeof numberOfDecimals === 'number') {
return new Numeric(
this.value.round(numberOfDecimals, roundingMode),
this.base,