From 61b8409f162d0379953621b554bacfbe2a07dfd7 Mon Sep 17 00:00:00 2001 From: Pranav Bhardwaj Date: Tue, 2 Jul 2024 23:30:43 -0400 Subject: [PATCH] boost coverage --- test/staking/SnapshotStakingPool.t.sol | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/staking/SnapshotStakingPool.t.sol b/test/staking/SnapshotStakingPool.t.sol index 28f76a0..1ad4cd9 100644 --- a/test/staking/SnapshotStakingPool.t.sol +++ b/test/staking/SnapshotStakingPool.t.sol @@ -88,6 +88,19 @@ contract SnapshotStakingPoolTest is Test { assertEq(snapshotStakingPool.balanceOf(bob.addr), amount); assertEq(snapshotStakingPool.nextClaimId(bob.addr), 1); assertEq(snapshotStakingPool.getCurrentSnapshotId(), 0); + + _snapshot(1 ether); + _snapshot(1 ether); + + vm.prank(owner); + stakeToken.transfer(alice.addr, amount); + vm.prank(alice.addr); + stakeToken.approve(address(snapshotStakingPool), amount); + + vm.prank(alice.addr); + snapshotStakingPool.stake(amount); + + assertEq(snapshotStakingPool.nextClaimId(alice.addr), snapshotStakingPool.getCurrentSnapshotId()); } function testUnstake() public { @@ -295,6 +308,19 @@ contract SnapshotStakingPoolTest is Test { assertEq(snapshotStakingPool.canAccrue(), true); } + function testGetTimeUntilNextSnapshot() public { + vm.warp(block.timestamp + snapshotDelay + 1); + assertEq(snapshotStakingPool.getTimeUntilNextSnapshot(), 0); + + _stake(bob.addr, 1 ether); + _snapshot(1 ether); + + assertEq(snapshotStakingPool.getTimeUntilNextSnapshot(), snapshotDelay); + + vm.warp(block.timestamp + snapshotDelay - 10); + assertEq(snapshotStakingPool.getTimeUntilNextSnapshot(), 10); + } + function testClaim() public { vm.prank(bob.addr); vm.expectRevert(SnapshotStakingPool.InvalidSnapshotId.selector);