livepeer / protocol

Livepeer protocol
MIT License
152 stars 45 forks source link

Abstract shared behavior from tests #568

Open RiccardoBiosas opened 2 years ago

RiccardoBiosas commented 2 years ago

Context The current unit/integration tests of the protocol are very extensive and meticulous, however their main 'side-effect' is that they repeat the same assertions to test different scenarios both across the same test suite and different files (i.e.: here and here). This would make the tests quite difficult to refactor should there be any changes in the business logic of the protocol in the future, and it also makes their code readability quite daunting. Also some chai matchers are imported on a file-basis rather than being defined globally.

Proposal Define the shared behavior of the tests and abstract it away in separate classes by using Mocha contexts.