Fix bignumber global test config

This commit is contained in:
David Racero 2020-09-09 16:35:49 +02:00
parent 398335124f
commit 23b7226a73
3 changed files with 15 additions and 4 deletions

View File

@ -504,8 +504,8 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
const mockFlashLoanReceiver = await deployMockFlashLoanReceiver(addressesProvider.address);
await insertContractAddressInDb(eContractid.MockFlashLoanReceiver, mockFlashLoanReceiver.address);
const mockSwapAdapter = await deployMockSwapAdapter(addressesProvider.address)
await insertContractAddressInDb(eContractid.MockSwapAdapter, mockSwapAdapter.address)
const mockSwapAdapter = await deployMockSwapAdapter(addressesProvider.address);
await insertContractAddressInDb(eContractid.MockSwapAdapter, mockSwapAdapter.address);
await deployWalletBalancerProvider(addressesProvider.address);

View File

@ -19,6 +19,12 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset',
USER_DID_NOT_BORROW_SPECIFIED,
THE_COLLATERAL_CHOSEN_CANNOT_BE_LIQUIDATED,
} = ProtocolErrors;
before('Before LendingPool liquidation: set config', () => {
BigNumber.config({DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_DOWN});
});
after('After LendingPool liquidation: reset config', () => {
BigNumber.config({DECIMAL_PLACES: 20, ROUNDING_MODE: BigNumber.ROUND_HALF_UP});
});
it('LIQUIDATION - Deposits WETH, borrows DAI', async () => {
const {dai, weth, users, pool, oracle} = testEnv;

View File

@ -8,8 +8,6 @@ import {getReservesConfigByPool} from '../helpers/constants';
import {AavePools, iAavePoolAssets, IReserveParams} from '../helpers/types';
import {executeStory} from './helpers/scenario-engine';
BigNumber.config({DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_DOWN});
const scenarioFolder = './test/helpers/scenarios/';
const selectedScenarios: string[] = [];
@ -21,12 +19,19 @@ fs.readdirSync(scenarioFolder).forEach((file) => {
makeSuite(scenario.title, async (testEnv) => {
before('Initializing configuration', async () => {
// Sets BigNumber for this suite, instead of globally
BigNumber.config({DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_DOWN});
actionsConfiguration.skipIntegrityCheck = false; //set this to true to execute solidity-coverage
calculationsConfiguration.reservesParams = <iAavePoolAssets<IReserveParams>>(
getReservesConfigByPool(AavePools.proto)
);
});
after('Reset', () => {
// Reset BigNumber
BigNumber.config({DECIMAL_PLACES: 20, ROUNDING_MODE: BigNumber.ROUND_HALF_UP});
});
for (const story of scenario.stories) {
it(story.description, async () => {