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:
2026-01-10 23:26:49 +01:00
parent ed1485cc16
commit 306fa38935
5 changed files with 357 additions and 111 deletions

View 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),
}