Skip to content

Commit

Permalink
Merge pull request #523 from aave/fix/520-reserve-factor-missing-test
Browse files Browse the repository at this point in the history
test: Add tests setting reserve factor >= `2**16 - 1`
  • Loading branch information
LHerskind authored Jan 3, 2022
2 parents e792a92 + d47b777 commit 89654a7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test-suites/reserve-configuration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe('ReserveConfiguration', async () => {
const MAX_VALID_LIQUIDATION_THRESHOLD = BigNumber.from(65535);
const MAX_VALID_DECIMALS = BigNumber.from(255);
const MAX_VALID_EMODE_CATEGORY = BigNumber.from(255);
const MAX_VALID_RESERVE_FACTOR = BigNumber.from(65535);

before(async () => {
configMock = await deployMockReserveConfiguration();
Expand Down Expand Up @@ -164,6 +165,28 @@ describe('ReserveConfiguration', async () => {
expect(await configMock.getReserveFactor()).to.be.eq(ZERO);
});

it('setReserveFactor() with reserveFactor == MAX_VALID_RESERVE_FACTOR', async () => {
expect(bigNumbersToArrayString(await configMock.getParams())).to.be.eql(
bigNumbersToArrayString([ZERO, ZERO, ZERO, ZERO, ZERO, ZERO])
);
expect(await configMock.setReserveFactor(MAX_VALID_RESERVE_FACTOR));
expect(bigNumbersToArrayString(await configMock.getParams())).to.be.eql(
bigNumbersToArrayString([ZERO, ZERO, ZERO, ZERO, MAX_VALID_RESERVE_FACTOR, ZERO])
);
});

it('setReserveFactor() with reserveFactor > MAX_VALID_RESERVE_FACTOR', async () => {
expect(bigNumbersToArrayString(await configMock.getParams())).to.be.eql(
bigNumbersToArrayString([ZERO, ZERO, ZERO, ZERO, ZERO, ZERO])
);
await expect(configMock.setReserveFactor(MAX_VALID_RESERVE_FACTOR.add(1))).to.be.revertedWith(
ProtocolErrors.INVALID_RESERVE_FACTOR
);
expect(bigNumbersToArrayString(await configMock.getParams())).to.be.eql(
bigNumbersToArrayString([ZERO, ZERO, ZERO, ZERO, ZERO, ZERO])
);
});

it('getBorrowCap()', async () => {
expect(bigNumbersToArrayString(await configMock.getCaps())).to.be.eql(
bigNumbersToArrayString([ZERO, ZERO])
Expand Down

0 comments on commit 89654a7

Please sign in to comment.