fix snapshots

This commit is contained in:
andyk 2020-06-10 15:47:39 +03:00
parent 070b46552a
commit 268dcdead8
5 changed files with 22 additions and 15 deletions

View File

@ -33,7 +33,6 @@ import {
getEthersSigners,
} from "../helpers/contracts-helpers";
import {LendingPoolAddressesProvider} from "../types/LendingPoolAddressesProvider";
import {evmSnapshot} from "../helpers/misc-utils";
import {Wallet, ContractTransaction, ethers, Signer} from "ethers";
import {
TokenContractId,
@ -621,8 +620,6 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
testHelpers.address
);
await evmSnapshot();
console.timeEnd("setup");
};

View File

@ -7,15 +7,15 @@ import {
import {evmRevert} from "../helpers/misc-utils";
import {AToken} from "../types/AToken";
import {TEST_SNAPSHOT_ID} from "../helpers/constants";
import { makeSuite } from './helpers/make-suite';
describe("AToken: Modifiers", () => {
makeSuite("AToken: Modifiers", () => {
const [deployer, ...restWallets] = new MockProvider().getWallets();
let _aDAI = {} as AToken;
const NOT_LENDING_POOL_MSG =
"The caller of this function must be a lending pool";
before(async () => {
await evmRevert(TEST_SNAPSHOT_ID);
const testHelpers = await getAaveProtocolTestHelpers();
const aDAIAddress = (await testHelpers.getAllATokens()).find(

View File

@ -1,6 +1,4 @@
import {evmRevert} from "../helpers/misc-utils";
import {
TEST_SNAPSHOT_ID,
APPROVAL_AMOUNT_LENDING_POOL_CORE,
MOCK_ETH_ADDRESS,
AAVE_REFERRAL,
@ -23,8 +21,11 @@ import {
import {expect} from "chai";
import {Signer, ethers} from "ethers";
import {RateMode} from "../helpers/types";
import { makeSuite } from './helpers/make-suite';
describe("AToken: Transfer", () => {
makeSuite("AToken: Transfer", () => {
let deployer: Signer;
let users: Signer[];
let _aDai: AToken;
@ -33,8 +34,6 @@ describe("AToken: Transfer", () => {
let _lendingPoolCore: LendingPoolCore;
before(async () => {
await evmRevert(TEST_SNAPSHOT_ID);
const [_deployer, ..._users] = await getEthersSigners();
deployer = _deployer;
users = _users;

View File

@ -0,0 +1,14 @@
import { evmRevert, evmSnapshot } from '../../helpers/misc-utils';
import { TEST_SNAPSHOT_ID } from '../../helpers/constants';
export function makeSuite(name: string, tests: () => void) {
describe(name, function () {
before(async () => {
await evmSnapshot();
});
tests();
after(async () => {
await evmRevert(TEST_SNAPSHOT_ID);
});
});
}

View File

@ -3,14 +3,11 @@ import {MockProvider} from "ethereum-waffle";
import {getLendingPoolAddressesProvider} from "../helpers/contracts-helpers";
import {createRandomAddress, evmRevert} from "../helpers/misc-utils";
import {TEST_SNAPSHOT_ID} from "../helpers/constants";
import { makeSuite } from './helpers/make-suite';
describe("LendingPoolAddressesProvider", () => {
makeSuite("LendingPoolAddressesProvider", () => {
const wallets = new MockProvider().getWallets();
before(async () => {
await evmRevert(TEST_SNAPSHOT_ID);
});
it("Test the accessibility of the LendingPoolAddressesProvider", async () => {
const mockAddress = createRandomAddress();
const INVALID_OWNER_REVERT_MSG = "Ownable: caller is not the owner";