mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
added test on removal of an addresses provider
This commit is contained in:
parent
2a5547570c
commit
7c892ec4ba
|
@ -363,7 +363,7 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
||||||
|
|
||||||
const addressesProviderRegistry = await deployLendingPoolAddressesProviderRegistry();
|
const addressesProviderRegistry = await deployLendingPoolAddressesProviderRegistry();
|
||||||
await waitForTx(
|
await waitForTx(
|
||||||
await addressesProviderRegistry.registerAddressesProvider(addressesProvider.address, 0)
|
await addressesProviderRegistry.registerAddressesProvider(addressesProvider.address, 1)
|
||||||
);
|
);
|
||||||
|
|
||||||
const lendingPoolImpl = await deployLendingPool();
|
const lendingPoolImpl = await deployLendingPool();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import {TestEnv, makeSuite} from './helpers/make-suite';
|
import {TestEnv, makeSuite} from './helpers/make-suite';
|
||||||
import {RAY, APPROVAL_AMOUNT_LENDING_POOL} from '../helpers/constants';
|
import {RAY, APPROVAL_AMOUNT_LENDING_POOL, ZERO_ADDRESS} from '../helpers/constants';
|
||||||
import {convertToCurrencyDecimals} from '../helpers/contracts-helpers';
|
import {convertToCurrencyDecimals} from '../helpers/contracts-helpers';
|
||||||
import {ProtocolErrors} from '../helpers/types';
|
import {ProtocolErrors} from '../helpers/types';
|
||||||
|
|
||||||
|
@ -14,20 +14,10 @@ makeSuite('AddressesProviderRegistry', (testEnv: TestEnv) => {
|
||||||
const providers = await registry.getAddressesProvidersList();
|
const providers = await registry.getAddressesProvidersList();
|
||||||
|
|
||||||
expect(providers.length).to.be.equal(1, "Invalid length of the addresses providers list");
|
expect(providers.length).to.be.equal(1, "Invalid length of the addresses providers list");
|
||||||
expect(providers[1].toString()).to.be.equal(addressesProvider.address, " Invalid addresses provider added to the list");
|
expect(providers[0].toString()).to.be.equal(addressesProvider.address, " Invalid addresses provider added to the list");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Checks the addresses provider is added to the registry', async () => {
|
|
||||||
|
|
||||||
const {addressesProvider, registry} = testEnv;
|
|
||||||
|
|
||||||
const providers = await registry.getAddressesProvidersList();
|
|
||||||
|
|
||||||
expect(providers.length).to.be.equal(1, "Invalid length of the addresses providers list");
|
|
||||||
expect(providers[1].toString()).to.be.equal(addressesProvider.address, " Invalid addresses provider added to the list");
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Registers a new mock addresses provider', async () => {
|
it('Registers a new mock addresses provider', async () => {
|
||||||
|
|
||||||
|
@ -39,24 +29,27 @@ makeSuite('AddressesProviderRegistry', (testEnv: TestEnv) => {
|
||||||
const providers = await registry.getAddressesProvidersList();
|
const providers = await registry.getAddressesProvidersList();
|
||||||
|
|
||||||
expect(providers.length).to.be.equal(2, "Invalid length of the addresses providers list");
|
expect(providers.length).to.be.equal(2, "Invalid length of the addresses providers list");
|
||||||
expect(providers[2].toString()).to.be.equal(users[1].address, " Invalid addresses provider added to the list");
|
expect(providers[1].toString()).to.be.equal(users[1].address, " Invalid addresses provider added to the list");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Registers a new mock addresses provider', async () => {
|
it('Removes the mock addresses provider', async () => {
|
||||||
|
|
||||||
const {users, registry} = testEnv;
|
const {users, registry, addressesProvider} = testEnv;
|
||||||
|
|
||||||
//simulating an addresses provider using the users[1] wallet address
|
//checking the isAddressesProviderRegistered function
|
||||||
await registry.registerAddressesProvider(users[1].address, "2");
|
const id = await registry.isAddressesProviderRegistered(users[1].address);
|
||||||
|
|
||||||
|
expect(id).to.be.equal("2", "Invalid isRegistered return value");
|
||||||
|
|
||||||
|
await registry.unregisterAddressesProvider(users[1].address);
|
||||||
|
|
||||||
const providers = await registry.getAddressesProvidersList();
|
const providers = await registry.getAddressesProvidersList();
|
||||||
|
|
||||||
expect(providers.length).to.be.equal(2, "Invalid length of the addresses providers list");
|
expect(providers.length).to.be.equal(2, "Invalid length of the addresses providers list");
|
||||||
expect(providers[2].toString()).to.be.equal(users[1].address, " Invalid addresses provider added to the list");
|
expect(providers[0].toString()).to.be.equal(addressesProvider.address, " Invalid addresses provider added to the list");
|
||||||
|
expect(providers[1].toString()).to.be.equal(ZERO_ADDRESS, " Invalid addresses");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user