mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-15 15:50:38 +08:00
The tests in `crates/radicle-node/src/tests/.rs` repeat code quite a bit, for example, construction of IP addresses. Also, `Peer` is unnecessarily complex (too many struct members, state indicated via a boolean, type parameter that is always instantiated for the same type). Clean up `Peer` by removing multiple struct members, remove the unnecessary type parameter, and provide convenience functions that make statement of the actual tests a little less repetitive and more concise. For test networks, five standard nodes (Amy, Bob, Cid, Dan, Eve) are all easy to construct. Tests are refactored to make use of these nodes in lexicgraphic oreder. The order of initialization may differ. Modification of configuration is done by passing `FnMut`. In the future, using the builder pattern could be explored.