From d2848105f7fe8f99d4c1579b6ab99d156fa6a90c Mon Sep 17 00:00:00 2001 From: andyk Date: Fri, 21 Aug 2020 10:33:06 +0300 Subject: [PATCH] fix liquidation test --- test/liquidation-atoken.spec.ts | 2 +- test/liquidation-underlying.spec.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/liquidation-atoken.spec.ts b/test/liquidation-atoken.spec.ts index 1676c224..4ef8bb60 100644 --- a/test/liquidation-atoken.spec.ts +++ b/test/liquidation-atoken.spec.ts @@ -101,7 +101,7 @@ makeSuite('LendingPool liquidation - liquidator receiving aToken', (testEnv) => }); 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]; await expect( diff --git a/test/liquidation-underlying.spec.ts b/test/liquidation-underlying.spec.ts index e554cd70..e60525c0 100644 --- a/test/liquidation-underlying.spec.ts +++ b/test/liquidation-underlying.spec.ts @@ -13,15 +13,15 @@ chai.use(require('chai-bignumber')()); 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( expected.plus(new BigNumber(1)).eq(actual) || expected.plus(new BigNumber(2)).eq(actual) || actual.plus(new BigNumber(1)).eq(expected) || actual.plus(new BigNumber(2)).eq(expected) || expected.eq(actual), - 'expected #{act} to be almost equal #{exp}', - 'expected #{act} to be different from #{exp}', + `${message} expected #{act} to be almost equal #{exp}`, + `${message} expected #{act} to be different from #{exp}`, expected.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.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')) { var expected = new BigNumber(value); var actual = new BigNumber(this._obj); - almostEqual.apply(this, [expected, actual]); + almostEqual.apply(this, [expected, actual, message]); } else { original.apply(this, arguments); } @@ -175,7 +175,7 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset', const stableDebtBeforeTx = calcExpectedStableDebtTokenBalance( userReserveDataBefore, - txTimestamp.plus(2) + txTimestamp ); expect(userReserveDataAfter.currentStableDebt.toString()).to.be.bignumber.almostEqual(