mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
fix liquidation test
This commit is contained in:
parent
cdaa313f65
commit
d2848105f7
|
@ -101,7 +101,7 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) =>
|
||||||
});
|
});
|
||||||
|
|
||||||
it('LIQUIDATION - Tries to liquidate a different collateral than the borrower collateral', async () => {
|
it('LIQUIDATION - Tries to liquidate a different collateral than the borrower collateral', async () => {
|
||||||
const {pool, dai, weth, users} = testEnv;
|
const {pool, dai, users} = testEnv;
|
||||||
const borrower = users[1];
|
const borrower = users[1];
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
|
|
|
@ -13,15 +13,15 @@ chai.use(require('chai-bignumber')());
|
||||||
|
|
||||||
const {expect} = chai;
|
const {expect} = chai;
|
||||||
|
|
||||||
const almostEqual: any = function (this: any, expected: any, actual: any): any {
|
const almostEqual: any = function (this: any, expected: any, actual: any, message: string): any {
|
||||||
this.assert(
|
this.assert(
|
||||||
expected.plus(new BigNumber(1)).eq(actual) ||
|
expected.plus(new BigNumber(1)).eq(actual) ||
|
||||||
expected.plus(new BigNumber(2)).eq(actual) ||
|
expected.plus(new BigNumber(2)).eq(actual) ||
|
||||||
actual.plus(new BigNumber(1)).eq(expected) ||
|
actual.plus(new BigNumber(1)).eq(expected) ||
|
||||||
actual.plus(new BigNumber(2)).eq(expected) ||
|
actual.plus(new BigNumber(2)).eq(expected) ||
|
||||||
expected.eq(actual),
|
expected.eq(actual),
|
||||||
'expected #{act} to be almost equal #{exp}',
|
`${message} expected #{act} to be almost equal #{exp}`,
|
||||||
'expected #{act} to be different from #{exp}',
|
`${message} expected #{act} to be different from #{exp}`,
|
||||||
expected.toString(),
|
expected.toString(),
|
||||||
actual.toString()
|
actual.toString()
|
||||||
);
|
);
|
||||||
|
@ -29,11 +29,11 @@ const almostEqual: any = function (this: any, expected: any, actual: any): any {
|
||||||
|
|
||||||
chai.use(function (chai: any, utils: any) {
|
chai.use(function (chai: any, utils: any) {
|
||||||
chai.Assertion.overwriteMethod('almostEqual', function (original: any) {
|
chai.Assertion.overwriteMethod('almostEqual', function (original: any) {
|
||||||
return function (this: any, value: any) {
|
return function (this: any, value: any, message: string) {
|
||||||
if (utils.flag(this, 'bignumber')) {
|
if (utils.flag(this, 'bignumber')) {
|
||||||
var expected = new BigNumber(value);
|
var expected = new BigNumber(value);
|
||||||
var actual = new BigNumber(this._obj);
|
var actual = new BigNumber(this._obj);
|
||||||
almostEqual.apply(this, [expected, actual]);
|
almostEqual.apply(this, [expected, actual, message]);
|
||||||
} else {
|
} else {
|
||||||
original.apply(this, arguments);
|
original.apply(this, arguments);
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset',
|
||||||
|
|
||||||
const stableDebtBeforeTx = calcExpectedStableDebtTokenBalance(
|
const stableDebtBeforeTx = calcExpectedStableDebtTokenBalance(
|
||||||
userReserveDataBefore,
|
userReserveDataBefore,
|
||||||
txTimestamp.plus(2)
|
txTimestamp
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(userReserveDataAfter.currentStableDebt.toString()).to.be.bignumber.almostEqual(
|
expect(userReserveDataAfter.currentStableDebt.toString()).to.be.bignumber.almostEqual(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user