Sovryn-smart-contracts
Sovryn-smart-contracts copied to clipboard
Refactor Hardhat tests
the tests are slow and can be improved dramatically suggestions:
- snapshot repeating scenarios https://ethereum-waffle.readthedocs.io/en/latest/fixtures.html
- use mocks https://ethereum-waffle.readthedocs.io/en/latest/mock-contract.html added a task
- beforeEach -> before move repetitive beforeEach with redeployment to before whenever possible - when no need to real redeploy (or use p.1)
- extract common deployment in tests into a shared functions e.g. deployProtocol, deployLoanTokens, deployLiquidityMining and then just call these functions in before or beforeEach
Another idea: https://www.youtube.com/watch?v=vn3tm0quoqE