aave-protocol-v2/test/lending-pool-addresses-provider.spec.ts

38 lines
1.4 KiB
TypeScript
Raw Normal View History

import {expect} from "chai";
import {MockProvider} from "ethereum-waffle";
import {BuidlerRuntimeEnvironment} from "@nomiclabs/buidler/types";
2020-06-08 15:36:40 +00:00
import {getLendingPoolAddressesProvider} from "../helpers/contracts-helpers";
import {createRandomAddress, evmRevert} from "../helpers/misc-utils";
describe("LendingPoolAddressesProvider", () => {
const wallets = new MockProvider().getWallets();
before(async () => {
2020-06-08 15:36:40 +00:00
await evmRevert("0x1");
});
it("Test the accessibility of the LendingPoolAddressesProvider", async () => {
const mockAddress = createRandomAddress();
const INVALID_OWNER_REVERT_MSG = "Ownable: caller is not the owner";
2020-06-08 15:36:40 +00:00
const addressesProvider = await getLendingPoolAddressesProvider();
await addressesProvider.transferOwnership(wallets[1].address);
for (const contractFunction of [
addressesProvider.setFeeProviderImpl,
addressesProvider.setLendingPoolImpl,
addressesProvider.setLendingPoolConfiguratorImpl,
addressesProvider.setLendingPoolCoreImpl,
addressesProvider.setLendingPoolDataProviderImpl,
addressesProvider.setLendingPoolLiquidationManager,
addressesProvider.setLendingPoolManager,
addressesProvider.setLendingPoolParametersProviderImpl,
addressesProvider.setPriceOracle,
addressesProvider.setLendingRateOracle,
]) {
await expect(contractFunction(mockAddress)).to.be.revertedWith(
INVALID_OWNER_REVERT_MSG
);
}
});
});