Skip to content

Commit

Permalink
test: repay amount and interest rate mode
Browse files Browse the repository at this point in the history
  • Loading branch information
grothem committed Oct 24, 2023
1 parent 46fe68f commit 0efe719
Showing 1 changed file with 37 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -591,22 +591,31 @@ describe('PoolBundle', () => {
expect(resultStable.data).toEqual(txData);
});

it('encodes borrow params for L2', async () => {
it('encodes variable borrow params for L2', async () => {
await instance.borrowTxBuilder.encodeBorrowParams({
reserve: TOKEN,
amount: '1',
interestRateMode: InterestRate.Variable,
referralCode: '1',
});

expect(encoderSpy).toHaveBeenCalled();

await instance.borrowTxBuilder.encodeBorrowParams({
reserve: TOKEN,
amount: '-1',
interestRateMode: InterestRate.Stable,
referralCode: '1',
});

expect(encoderSpy).toHaveBeenCalled();
});

it('encodes borrow params for L2 without referral code', async () => {
await instance.borrowTxBuilder.encodeBorrowParams({
reserve: TOKEN,
amount: '1',
interestRateMode: InterestRate.Variable,
});

expect(encoderSpy).toHaveBeenCalled();
});
});
Expand Down Expand Up @@ -831,9 +840,14 @@ describe('PoolBundle', () => {
interestRateMode: InterestRate.Variable,
});
expect(encoderSpy).toHaveBeenCalled();
});

it('encodes repay with permit params for L2', async () => {
await instance.repayTxBuilder.encodeRepayParams({
reserve: TOKEN,
amount: '-1',
interestRateMode: InterestRate.Stable,
});
expect(encoderSpy).toHaveBeenCalled();

await instance.repayTxBuilder.encodeRepayWithPermitParams({
reserve: TOKEN,
amount: '1',
Expand All @@ -843,6 +857,16 @@ describe('PoolBundle', () => {
'0x532f8df4e2502bd869fb35e9301156f9b307380afdcc25cfbc87b2e939f16f7e47c326dc26eb918d327358797ee67ad7415d871ef7eaf0d4f6352d3ad021fbb41c',
});
expect(encoderSpy).toHaveBeenCalled();

await instance.repayTxBuilder.encodeRepayWithPermitParams({
reserve: TOKEN,
amount: '-1',
interestRateMode: InterestRate.Stable,
deadline: '10000',
signature:
'0x532f8df4e2502bd869fb35e9301156f9b307380afdcc25cfbc87b2e939f16f7e47c326dc26eb918d327358797ee67ad7415d871ef7eaf0d4f6352d3ad021fbb41c',
});
expect(encoderSpy).toHaveBeenCalled();
});
});

Expand Down Expand Up @@ -936,10 +960,17 @@ describe('PoolBundle', () => {
it('encodes repay with aToken params for L2', async () => {
await instance.repayWithATokensTxBuilder.encodeRepayWithATokensParams({
reserve: TOKEN,
amount: '1',
amount: '-1',
rateMode: InterestRate.Variable,
});
expect(encoderSpy).toHaveBeenCalled();

await instance.repayWithATokensTxBuilder.encodeRepayWithATokensParams({
reserve: TOKEN,
amount: '1',
rateMode: InterestRate.Stable,
});
expect(encoderSpy).toHaveBeenCalled();
});
});
});

0 comments on commit 0efe719

Please sign in to comment.