@0x/contracts-test-utils
: Add msg
param to assertIntegerRoughlyEquals
This commit is contained in:
parent
cfc3daeb65
commit
0e1a5a375a
@ -1,4 +1,13 @@
|
||||
[
|
||||
{
|
||||
"version": "5.3.3",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Add `msg` param to `assertIntegerRoughlyEquals`",
|
||||
"pr": 2576
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1583220306,
|
||||
"version": "5.3.2",
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user