status-go
status-go copied to clipboard
Test/ut router
Router V2 refactoring to smaller pieces to allow unit testing
These are sample tests to demo. Proper better return values and params should be used.
The code is complex, so within a limited timeframe I had I've made an attempt to:
- split big functions to smaller ones that have their own sense
- remove unneeded dependencies where possible to avoid more mocks and EXPECTs
- cover a couple of them with unit tests
More attention should be to paid to:
- Router declaration - aggregation of interfaces. That allows to test more complex flows without repeating the inner low level EXPECT calls in more high level functions
- routerv2_ut_tests.go
- 1 test for Router
- 1 test for Candidate resolver
Separately should be tested:
- Estimator
- Each path processor
- Other dependencies