test(infrastructure): implement MockRelayLabelRepository for testing
Create in-memory mock implementation of RelayLabelRepository trait using HashMap with Arc<Mutex<>> for thread-safe concurrent access. Includes 8 comprehensive tests covering all trait methods and edge cases. Also refactor domain repository module structure to support multiple repository types (repository.rs → repository/label.rs + mod.rs). TDD phase: Combined red-green (tests + implementation) Ref: T037, T038
This commit is contained in:
18
backend/src/domain/relay/repository/mod.rs
Normal file
18
backend/src/domain/relay/repository/mod.rs
Normal file
@@ -0,0 +1,18 @@
|
||||
mod label;
|
||||
pub use label::RelayLabelRepository;
|
||||
|
||||
use super::types::RelayId;
|
||||
|
||||
/// Errors that can occur during repository operations.
|
||||
///
|
||||
/// This enum provides structured error handling for all data persistence
|
||||
/// operations related to relay management.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum RepositoryError {
|
||||
/// A database operation failed with the given error message.
|
||||
#[error("Database error: {0}")]
|
||||
DatabaseError(String),
|
||||
/// The requested relay was not found in the repository.
|
||||
#[error("Relay not found: {0}")]
|
||||
NotFound(RelayId),
|
||||
}
|
||||
Reference in New Issue
Block a user