mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
fix snapshots
This commit is contained in:
parent
070b46552a
commit
268dcdead8
|
@ -33,7 +33,6 @@ import {
|
||||||
getEthersSigners,
|
getEthersSigners,
|
||||||
} from "../helpers/contracts-helpers";
|
} from "../helpers/contracts-helpers";
|
||||||
import {LendingPoolAddressesProvider} from "../types/LendingPoolAddressesProvider";
|
import {LendingPoolAddressesProvider} from "../types/LendingPoolAddressesProvider";
|
||||||
import {evmSnapshot} from "../helpers/misc-utils";
|
|
||||||
import {Wallet, ContractTransaction, ethers, Signer} from "ethers";
|
import {Wallet, ContractTransaction, ethers, Signer} from "ethers";
|
||||||
import {
|
import {
|
||||||
TokenContractId,
|
TokenContractId,
|
||||||
|
@ -621,8 +620,6 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
||||||
testHelpers.address
|
testHelpers.address
|
||||||
);
|
);
|
||||||
|
|
||||||
await evmSnapshot();
|
|
||||||
|
|
||||||
console.timeEnd("setup");
|
console.timeEnd("setup");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,15 +7,15 @@ import {
|
||||||
import {evmRevert} from "../helpers/misc-utils";
|
import {evmRevert} from "../helpers/misc-utils";
|
||||||
import {AToken} from "../types/AToken";
|
import {AToken} from "../types/AToken";
|
||||||
import {TEST_SNAPSHOT_ID} from "../helpers/constants";
|
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();
|
const [deployer, ...restWallets] = new MockProvider().getWallets();
|
||||||
let _aDAI = {} as AToken;
|
let _aDAI = {} as AToken;
|
||||||
const NOT_LENDING_POOL_MSG =
|
const NOT_LENDING_POOL_MSG =
|
||||||
"The caller of this function must be a lending pool";
|
"The caller of this function must be a lending pool";
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await evmRevert(TEST_SNAPSHOT_ID);
|
|
||||||
const testHelpers = await getAaveProtocolTestHelpers();
|
const testHelpers = await getAaveProtocolTestHelpers();
|
||||||
|
|
||||||
const aDAIAddress = (await testHelpers.getAllATokens()).find(
|
const aDAIAddress = (await testHelpers.getAllATokens()).find(
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import {evmRevert} from "../helpers/misc-utils";
|
|
||||||
import {
|
import {
|
||||||
TEST_SNAPSHOT_ID,
|
|
||||||
APPROVAL_AMOUNT_LENDING_POOL_CORE,
|
APPROVAL_AMOUNT_LENDING_POOL_CORE,
|
||||||
MOCK_ETH_ADDRESS,
|
MOCK_ETH_ADDRESS,
|
||||||
AAVE_REFERRAL,
|
AAVE_REFERRAL,
|
||||||
|
@ -23,8 +21,11 @@ import {
|
||||||
import {expect} from "chai";
|
import {expect} from "chai";
|
||||||
import {Signer, ethers} from "ethers";
|
import {Signer, ethers} from "ethers";
|
||||||
import {RateMode} from "../helpers/types";
|
import {RateMode} from "../helpers/types";
|
||||||
|
import { makeSuite } from './helpers/make-suite';
|
||||||
|
|
||||||
describe("AToken: Transfer", () => {
|
|
||||||
|
|
||||||
|
makeSuite("AToken: Transfer", () => {
|
||||||
let deployer: Signer;
|
let deployer: Signer;
|
||||||
let users: Signer[];
|
let users: Signer[];
|
||||||
let _aDai: AToken;
|
let _aDai: AToken;
|
||||||
|
@ -33,8 +34,6 @@ describe("AToken: Transfer", () => {
|
||||||
let _lendingPoolCore: LendingPoolCore;
|
let _lendingPoolCore: LendingPoolCore;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await evmRevert(TEST_SNAPSHOT_ID);
|
|
||||||
|
|
||||||
const [_deployer, ..._users] = await getEthersSigners();
|
const [_deployer, ..._users] = await getEthersSigners();
|
||||||
deployer = _deployer;
|
deployer = _deployer;
|
||||||
users = _users;
|
users = _users;
|
||||||
|
|
14
test/helpers/make-suite.ts
Normal file
14
test/helpers/make-suite.ts
Normal 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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
|
@ -3,14 +3,11 @@ import {MockProvider} from "ethereum-waffle";
|
||||||
import {getLendingPoolAddressesProvider} from "../helpers/contracts-helpers";
|
import {getLendingPoolAddressesProvider} from "../helpers/contracts-helpers";
|
||||||
import {createRandomAddress, evmRevert} from "../helpers/misc-utils";
|
import {createRandomAddress, evmRevert} from "../helpers/misc-utils";
|
||||||
import {TEST_SNAPSHOT_ID} from "../helpers/constants";
|
import {TEST_SNAPSHOT_ID} from "../helpers/constants";
|
||||||
|
import { makeSuite } from './helpers/make-suite';
|
||||||
|
|
||||||
describe("LendingPoolAddressesProvider", () => {
|
makeSuite("LendingPoolAddressesProvider", () => {
|
||||||
const wallets = new MockProvider().getWallets();
|
const wallets = new MockProvider().getWallets();
|
||||||
|
|
||||||
before(async () => {
|
|
||||||
await evmRevert(TEST_SNAPSHOT_ID);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Test the accessibility of the LendingPoolAddressesProvider", async () => {
|
it("Test the accessibility of the LendingPoolAddressesProvider", async () => {
|
||||||
const mockAddress = createRandomAddress();
|
const mockAddress = createRandomAddress();
|
||||||
const INVALID_OWNER_REVERT_MSG = "Ownable: caller is not the owner";
|
const INVALID_OWNER_REVERT_MSG = "Ownable: caller is not the owner";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user