Sovryn-smart-contracts icon indicating copy to clipboard operation
Sovryn-smart-contracts copied to clipboard

Refactor Hardhat tests

Open ghost opened this issue 4 years ago • 0 comments

the tests are slow and can be improved dramatically suggestions:

  1. snapshot repeating scenarios https://ethereum-waffle.readthedocs.io/en/latest/fixtures.html
  2. use mocks https://ethereum-waffle.readthedocs.io/en/latest/mock-contract.html added a task
  3. beforeEach -> before move repetitive beforeEach with redeployment to before whenever possible - when no need to real redeploy (or use p.1)
  4. 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

ghost avatar Jun 03 '21 14:06 ghost