mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fix bignumber global test config
This commit is contained in:
parent
398335124f
commit
23b7226a73
|
@ -504,8 +504,8 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
||||||
const mockFlashLoanReceiver = await deployMockFlashLoanReceiver(addressesProvider.address);
|
const mockFlashLoanReceiver = await deployMockFlashLoanReceiver(addressesProvider.address);
|
||||||
await insertContractAddressInDb(eContractid.MockFlashLoanReceiver, mockFlashLoanReceiver.address);
|
await insertContractAddressInDb(eContractid.MockFlashLoanReceiver, mockFlashLoanReceiver.address);
|
||||||
|
|
||||||
const mockSwapAdapter = await deployMockSwapAdapter(addressesProvider.address)
|
const mockSwapAdapter = await deployMockSwapAdapter(addressesProvider.address);
|
||||||
await insertContractAddressInDb(eContractid.MockSwapAdapter, mockSwapAdapter.address)
|
await insertContractAddressInDb(eContractid.MockSwapAdapter, mockSwapAdapter.address);
|
||||||
|
|
||||||
await deployWalletBalancerProvider(addressesProvider.address);
|
await deployWalletBalancerProvider(addressesProvider.address);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,12 @@ makeSuite('LendingPool liquidation - liquidator receiving the underlying asset',
|
||||||
USER_DID_NOT_BORROW_SPECIFIED,
|
USER_DID_NOT_BORROW_SPECIFIED,
|
||||||
THE_COLLATERAL_CHOSEN_CANNOT_BE_LIQUIDATED,
|
THE_COLLATERAL_CHOSEN_CANNOT_BE_LIQUIDATED,
|
||||||
} = ProtocolErrors;
|
} = 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 () => {
|
it('LIQUIDATION - Deposits WETH, borrows DAI', async () => {
|
||||||
const {dai, weth, users, pool, oracle} = testEnv;
|
const {dai, weth, users, pool, oracle} = testEnv;
|
||||||
|
|
|
@ -8,8 +8,6 @@ import {getReservesConfigByPool} from '../helpers/constants';
|
||||||
import {AavePools, iAavePoolAssets, IReserveParams} from '../helpers/types';
|
import {AavePools, iAavePoolAssets, IReserveParams} from '../helpers/types';
|
||||||
import {executeStory} from './helpers/scenario-engine';
|
import {executeStory} from './helpers/scenario-engine';
|
||||||
|
|
||||||
BigNumber.config({DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_DOWN});
|
|
||||||
|
|
||||||
const scenarioFolder = './test/helpers/scenarios/';
|
const scenarioFolder = './test/helpers/scenarios/';
|
||||||
|
|
||||||
const selectedScenarios: string[] = [];
|
const selectedScenarios: string[] = [];
|
||||||
|
@ -21,12 +19,19 @@ fs.readdirSync(scenarioFolder).forEach((file) => {
|
||||||
|
|
||||||
makeSuite(scenario.title, async (testEnv) => {
|
makeSuite(scenario.title, async (testEnv) => {
|
||||||
before('Initializing configuration', async () => {
|
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
|
actionsConfiguration.skipIntegrityCheck = false; //set this to true to execute solidity-coverage
|
||||||
|
|
||||||
calculationsConfiguration.reservesParams = <iAavePoolAssets<IReserveParams>>(
|
calculationsConfiguration.reservesParams = <iAavePoolAssets<IReserveParams>>(
|
||||||
getReservesConfigByPool(AavePools.proto)
|
getReservesConfigByPool(AavePools.proto)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
after('Reset', () => {
|
||||||
|
// Reset BigNumber
|
||||||
|
BigNumber.config({DECIMAL_PLACES: 20, ROUNDING_MODE: BigNumber.ROUND_HALF_UP});
|
||||||
|
});
|
||||||
|
|
||||||
for (const story of scenario.stories) {
|
for (const story of scenario.stories) {
|
||||||
it(story.description, async () => {
|
it(story.description, async () => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user