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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<test/Allocators>: add test case for aave allocator #318

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

david30907d
Copy link

@david30907d david30907d commented Jun 6, 2022

WIP

  1. Hi there, I'm wondering if writing unittest for allocators is a good use of time?
    I'm solidity noob and want to try some easy ticket to ramp up~
  2. How can I enable CI on my personal repo? I've checked .github but still have no idea why CI workflow was not triggered when PR created in my forked repo

Comment on lines +72 to +79
it("invalid setReferralCode", async () => {
try {
await expect(aaveAllocator.connect(owner).setReferralCode(-1))
.to.be.revertedWith("value out-of-bounds (argument=\"code\", value=-1, code=INVALID_ARGUMENT, version=abi/5.5.0)");
} catch (error) {
console.log(error)
}
});
Copy link
Author

Choose a reason for hiding this comment

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

forgive my ignorance (I'm solidity noob), how can I expect an exception to be thrown in unittest?

In python, I can do this to assert an exception get raised in unittest:

def test_passes():
    with pytest.raises(Exception) as e_info:
        x = 1 / 0

Already googled around but didn't found useful hardhat doc

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.

1 participant