saorsa_core/messaging/mocks.rs
1// Mock implementations for testing
2// These implementations provide test doubles that don't require network access
3
4// use super::DhtClient; // Unused import - commented out
5use crate::network::P2PNode;
6
7// Mock implementations are provided via extension methods
8// The actual implementations need to be in the main modules to have access to private fields
9
10// For P2PNode mock
11impl P2PNode {
12 /// Create a mock P2P node for testing
13 /// Minimal non-networking mock suitable for unit tests
14 pub fn new_mock() -> Self {
15 // Provide a deterministic, no-op implementation for tests that only
16 // need a placeholder instance. For full integration, use real builder.
17 // Fall back to a trivial constructor if available, otherwise build a
18 // minimal instance via a dedicated test helper. This avoids panics in
19 // clippy and keeps production code free of unwrap/expect.
20 Self::new_for_tests()
21 }
22}
23
24// For DhtClient mock
25// Removed duplicate new_mock to avoid conflicts with core DHT client tests