Skip to content

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

Open
david30907d wants to merge 2 commits intoOlympusDAO:mainfrom
david30907d:dchang/aave-allocator-test
Open

<test/Allocators>: add test case for aave allocator#318
david30907d wants to merge 2 commits intoOlympusDAO:mainfrom
david30907d:dchang/aave-allocator-test

Conversation

@david30907d
Copy link
Copy Markdown

@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
Copy Markdown
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