@0x/contracts-test-utils: Add msg param to assertIntegerRoughlyEquals

This commit is contained in:
Lawrence Forman 2020-05-08 12:25:29 -04:00
parent cfc3daeb65
commit 0e1a5a375a
2 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,13 @@
[
{
"version": "5.3.3",
"changes": [
{
"note": "Add `msg` param to `assertIntegerRoughlyEquals`",
"pr": 2576
}
]
},
{
"timestamp": 1583220306,
"version": "5.3.2",

View File

@ -96,7 +96,12 @@ export function assertRoughlyEquals(actual: Numberish, expected: Numberish, prec
/**
* Asserts that two numbers are equal with up to `maxError` difference between them.
*/
export function assertIntegerRoughlyEquals(actual: Numberish, expected: Numberish, maxError: number = 1): void {
export function assertIntegerRoughlyEquals(
actual: Numberish,
expected: Numberish,
maxError: number = 1,
msg?: string,
): void {
const diff = new BigNumber(actual)
.minus(expected)
.abs()
@ -104,7 +109,7 @@ export function assertIntegerRoughlyEquals(actual: Numberish, expected: Numberis
if (diff <= maxError) {
return;
}
expect(actual).to.bignumber.eq(expected);
expect(actual, msg).to.bignumber.eq(expected);
}
/**