2020-07-04 07:32:54 +00:00
|
|
|
import {configuration as actionsConfiguration} from './helpers/actions';
|
|
|
|
import {configuration as calculationsConfiguration} from './helpers/utils/calculations';
|
2020-06-12 20:12:53 +00:00
|
|
|
|
2020-07-04 07:32:54 +00:00
|
|
|
import fs from 'fs';
|
|
|
|
import BigNumber from 'bignumber.js';
|
|
|
|
import {makeSuite} from './helpers/make-suite';
|
2020-08-13 11:06:23 +00:00
|
|
|
import {getReservesConfigByPool} from '../helpers/constants';
|
2020-07-04 07:32:54 +00:00
|
|
|
import {AavePools, iAavePoolAssets, IReserveParams} from '../helpers/types';
|
|
|
|
import {executeStory} from './helpers/scenario-engine';
|
2020-06-12 20:12:53 +00:00
|
|
|
|
2020-07-04 07:32:54 +00:00
|
|
|
const scenarioFolder = './test/helpers/scenarios/';
|
|
|
|
|
2020-09-25 09:51:35 +00:00
|
|
|
const selectedScenarios: string[] = ['set-use-as-collateral.json'];
|
2020-06-12 20:12:53 +00:00
|
|
|
|
|
|
|
fs.readdirSync(scenarioFolder).forEach((file) => {
|
2020-07-04 07:32:54 +00:00
|
|
|
if (selectedScenarios.length > 0 && !selectedScenarios.includes(file)) return;
|
2020-06-30 12:09:28 +00:00
|
|
|
|
2020-06-12 20:12:53 +00:00
|
|
|
const scenario = require(`./helpers/scenarios/${file}`);
|
|
|
|
|
|
|
|
makeSuite(scenario.title, async (testEnv) => {
|
2020-07-04 07:32:54 +00:00
|
|
|
before('Initializing configuration', async () => {
|
2020-09-09 14:35:49 +00:00
|
|
|
// Sets BigNumber for this suite, instead of globally
|
|
|
|
BigNumber.config({DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_DOWN});
|
|
|
|
|
2020-06-12 20:12:53 +00:00
|
|
|
actionsConfiguration.skipIntegrityCheck = false; //set this to true to execute solidity-coverage
|
|
|
|
|
2020-07-04 07:32:54 +00:00
|
|
|
calculationsConfiguration.reservesParams = <iAavePoolAssets<IReserveParams>>(
|
|
|
|
getReservesConfigByPool(AavePools.proto)
|
|
|
|
);
|
2020-06-12 20:12:53 +00:00
|
|
|
});
|
2020-09-09 14:35:49 +00:00
|
|
|
after('Reset', () => {
|
|
|
|
// Reset BigNumber
|
|
|
|
BigNumber.config({DECIMAL_PLACES: 20, ROUNDING_MODE: BigNumber.ROUND_HALF_UP});
|
|
|
|
});
|
2020-06-12 20:12:53 +00:00
|
|
|
|
|
|
|
for (const story of scenario.stories) {
|
|
|
|
it(story.description, async () => {
|
|
|
|
await executeStory(story, testEnv);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|