Skip to content

Commit

Permalink
[Farming] update farming tests snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
IliaAzhel committed Oct 10, 2024
1 parent ec140c1 commit 96ff0aa
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
33 changes: 24 additions & 9 deletions src/farming/test/unit/EternalFarms.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1445,33 +1445,48 @@ describe('unit/EternalFarms', () => {
});

it('do not update rewards if nothing to collect', async () => {
let rewardTokenAddress = await context.rewardToken.getAddress()
let bonusRewardTokenAddress = await context.bonusRewardToken.getAddress()

await context.eternalFarming.connect(actors.wallets[0]).setRates(
{
rewardToken: rewardTokenAddress,
bonusRewardToken: bonusRewardTokenAddress,
pool: context.pool01,
nonce: localNonce,
},
0,
0
);

await context.eternalFarming.connect(lpUser0).collectRewards(
{
rewardToken: await context.rewardToken.getAddress(),
bonusRewardToken: await context.bonusRewardToken.getAddress(),
rewardToken: rewardTokenAddress,
bonusRewardToken: bonusRewardTokenAddress,
pool: context.pool01,
nonce: localNonce,
},
tokenId,
lpUser0.address
);

const rewardTokenBalanceBefore = await context.eternalFarming.rewards(lpUser0.address, context.rewardToken);
const bonusRewardTokenBalanceBefore = await context.eternalFarming.rewards(lpUser0.address, context.bonusRewardToken);
const rewardTokenBalanceBefore = await context.eternalFarming.rewards(lpUser0.address, rewardTokenAddress);
const bonusRewardTokenBalanceBefore = await context.eternalFarming.rewards(lpUser0.address, bonusRewardTokenAddress);

await context.eternalFarming.connect(lpUser0).collectRewards(
{
rewardToken: await context.rewardToken.getAddress(),
bonusRewardToken: await context.bonusRewardToken.getAddress(),
rewardToken: rewardTokenAddress,
bonusRewardToken: bonusRewardTokenAddress,
pool: context.pool01,
nonce: localNonce,
},
tokenId,
lpUser0.address
);

const rewardTokenBalanceAfter = await context.eternalFarming.rewards(lpUser0.address, context.rewardToken);
const bonusRewardTokenBalanceAfter = await context.eternalFarming.rewards(lpUser0.address, context.bonusRewardToken);
const rewardTokenBalanceAfter = await context.eternalFarming.rewards(lpUser0.address, rewardTokenAddress);
const bonusRewardTokenBalanceAfter = await context.eternalFarming.rewards(lpUser0.address, bonusRewardTokenAddress);


expect(rewardTokenBalanceAfter).to.be.eq(rewardTokenBalanceBefore);
expect(bonusRewardTokenBalanceAfter).to.be.eq(bonusRewardTokenBalanceBefore);
Expand Down Expand Up @@ -1643,7 +1658,7 @@ describe('unit/EternalFarms', () => {
await context.rewardToken.getAddress(),
await context.bonusRewardToken.getAddress(),
lpUser0.address,
9999n,
9079n,
199n
);
});
Expand Down
16 changes: 8 additions & 8 deletions src/farming/test/unit/FarmingCenter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,11 @@ describe('unit/FarmingCenter', () => {
let balanceAfter = await context.eternalFarming.rewards(lpUser0.address, context.rewardToken);
let bonusBalanceAfter = await context.eternalFarming.rewards(lpUser0.address, context.bonusRewardToken);

expect(balanceAfter - balanceBefore).to.equal(199699n);
expect(bonusBalanceAfter - bonusBalanceBefore).to.equal(99549n);
expect(balanceAfter - balanceBefore).to.equal(189799);
expect(bonusBalanceAfter - bonusBalanceBefore).to.equal(94599);

await claimAndCheck(context.rewardToken, lpUser0, 199699n);
await claimAndCheck(context.bonusRewardToken, lpUser0, 99549n);
await claimAndCheck(context.rewardToken, lpUser0, 189799n);
await claimAndCheck(context.bonusRewardToken, lpUser0, 94599n);
});

it('collect rewards after eternalFarming deactivate', async () => {
Expand Down Expand Up @@ -631,11 +631,11 @@ describe('unit/FarmingCenter', () => {
let balanceAfter = await context.eternalFarming.rewards(lpUser0.address, context.rewardToken);
let bonusBalanceAfter = await context.eternalFarming.rewards(lpUser0.address, context.bonusRewardToken);

expect(balanceAfter - balanceBefore).to.equal(199699n);
expect(bonusBalanceAfter - bonusBalanceBefore).to.equal(99549n);
expect(balanceAfter - balanceBefore).to.equal(189799);
expect(bonusBalanceAfter - bonusBalanceBefore).to.equal(94599);

await claimAndCheck(context.rewardToken, lpUser0, 199699n);
await claimAndCheck(context.bonusRewardToken, lpUser0, 99549n);
await claimAndCheck(context.rewardToken, lpUser0, 189799n);
await claimAndCheck(context.bonusRewardToken, lpUser0, 94599n);
});

it('cannot collect if not owner', async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/farming/test/unit/__snapshots__/EternalFarms.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

exports[`unit/EternalFarms #claimReward when requesting the full amount has gas cost [ @skip-on-coverage ] 1`] = `60772`;

exports[`unit/EternalFarms #enterFarming works and has gas cost [ @skip-on-coverage ] 1`] = `506125`;
exports[`unit/EternalFarms #enterFarming works and has gas cost [ @skip-on-coverage ] 1`] = `499494`;

exports[`unit/EternalFarms #exitFarming after end time works and has gas cost [ @skip-on-coverage ] 1`] = `175750`;
exports[`unit/EternalFarms #exitFarming after end time works and has gas cost [ @skip-on-coverage ] 1`] = `177134`;

0 comments on commit 96ff0aa

Please sign in to comment.