Skip to content

Commit

Permalink
chore: increased test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 committed Oct 22, 2021
1 parent 0b87c31 commit 51c2f5d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contracts/z_mocks/savings/MockStakingContract.sol
Expand Up @@ -19,7 +19,7 @@ contract MockStakingContract {
_votes[account] = newVotes;

if(address(govHook) != address(0)) {
if (oldVotes < newVotes) {
if (oldVotes <= newVotes) {
govHook.moveVotingPowerHook(address(0), account, newVotes - oldVotes);
} else if (oldVotes > newVotes) {
govHook.moveVotingPowerHook(account, address(0), oldVotes - newVotes);
Expand Down
13 changes: 12 additions & 1 deletion test/rewards/emission-controller.spec.ts
Expand Up @@ -409,9 +409,20 @@ describe("EmissionsController", async () => {
})
context("Change voting power", () => {
context("first voting period", () => {
it("User 1 does not change their voting power", async () => {
expect(await emissionsController.callStatic.getVotes(sa.dummy1.address), "User 1 votes before").to.eq(
simpleToExactAmount(300),
)

await staking1.setVotes(sa.dummy1.address, user1Staking1Votes)

expect(await emissionsController.callStatic.getVotes(sa.dummy1.address), "User 1 votes after").to.eq(
simpleToExactAmount(300),
)
})
it("User 3 increases voting power before setting weights", async () => {
expect(await emissionsController.callStatic.getVotes(sa.dummy3.address), "User 3 votes before").to.eq(
simpleToExactAmount(300),
user3Staking1Votes,
)

await staking1.setVotes(sa.dummy3.address, simpleToExactAmount(400))
Expand Down

0 comments on commit 51c2f5d

Please sign in to comment.