Commit bb01e1a
committed
Refactor DHT configuration tests to eliminate code duplication
- Extract common test setup into createTestClient helper function
- Consolidate overlapping tests (TestDHTModeDefault, TestDHTModeServer, TestDHTModeClient) into TestDHTModeSelection
- Merge TestDHTModeServerWithVariousCleanupIntervals into TestDHTCleanupIntervalConfiguration
- Reduce test count from 11 to 5 while maintaining full coverage
- Use t.Helper() and t.Cleanup() for better test organization
- Add descriptive assertion messages for clearer failures
- Improve benchmark error handling
Changes:
- Lines of code reduced: 416 -> 312 (25% reduction)
- Tests consolidated: 11 -> 5 (same coverage, better organization)
- Code duplication eliminated: 9 repeated log setups, 11 repeated client creations now use 1 helper
- All tests still pass with identical coverage1 parent b8a62e1 commit bb01e1a
1 file changed
+176
-280
lines changed
0 commit comments