Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tests): add GaugeReward unit tests #272

Merged
merged 3 commits into from
May 27, 2022

Conversation

PierrickGT
Copy link
Contributor

No description provided.

@linear
Copy link

linear bot commented May 24, 2022

Copy link
Contributor

@asselstine asselstine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just some quibbles on tests

await token.mock.approve.withArgs(wallet2.address, '1111').returns(true)
await vault.increaseERC20Allowance(token.address, wallet2.address, '1111')
await tokenVault.increaseERC20Allowance(token.address, wallet2.address, '1111')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know what is interesting about this test- is that it doesn't assert the state change.

The mock doesn't have an expectation, so if the mock isn't called this test will still pass.

In this case, the easiest thing would be to instantiate a real token and check to see that the allowance was changed properly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: b945745

await token.mock.approve.withArgs(wallet2.address, '1111').returns(true)
await vault.connect(wallet3).increaseERC20Allowance(token.address, wallet2.address, '1111')
await tokenVault.connect(wallet3).increaseERC20Allowance(token.address, wallet2.address, '1111')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: b945745

await token.mock.approve.withArgs(wallet2.address, '111').returns(true)
await vault.decreaseERC20Allowance(token.address, wallet2.address, '1000')
await tokenVault.decreaseERC20Allowance(token.address, wallet2.address, '1000')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: b945745

await token.mock.approve.withArgs(wallet2.address, '0').returns(true)
await vault.connect(wallet3).decreaseERC20Allowance(token.address, wallet2.address, '1111')
await tokenVault.connect(wallet3).decreaseERC20Allowance(token.address, wallet2.address, '1111')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: b945745

await token.mock.approve.withArgs(wallet2.address, '0').returns(true)
await vault.connect(wallet3).decreaseERC20Allowance(token.address, wallet2.address, '1111')
await tokenVault.connect(wallet3).decreaseERC20Allowance(token.address, wallet2.address, '1111')
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about some revert checks for non-owner/managers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: b945745

@PierrickGT PierrickGT force-pushed the pool-2266-migrate-gaugereward-add-tests-bis branch from 5a61ae4 to 38cb693 Compare May 26, 2022 23:00
@PierrickGT PierrickGT force-pushed the pool-2266-migrate-gaugereward-add-tests-bis branch from 38cb693 to 181e3c7 Compare May 26, 2022 23:12
@PierrickGT PierrickGT force-pushed the pool-2266-migrate-gaugereward-add-tests-bis branch from b945745 to 4e1d4ef Compare May 27, 2022 21:39
@PierrickGT PierrickGT merged commit 4882710 into staging May 27, 2022
@PierrickGT PierrickGT deleted the pool-2266-migrate-gaugereward-add-tests-bis branch May 27, 2022 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants