test(infrastructure): write RelayLabelRepository trait tests
Add reusable test suite with 18 test functions covering get_label(), save_label(), delete_label(), and get_all_labels() methods. Tests verify contract compliance for any repository implementation. Added delete_label() method to trait interface and implemented it in MockRelayLabelRepository to support complete CRUD operations. TDD phase: RED - Tests written before SQLite implementation (T036) Ref: T035 (specs/001-modbus-relay-control/tasks.md)
This commit is contained in:
@@ -29,6 +29,15 @@ pub trait RelayLabelRepository: Send + Sync {
|
||||
/// Returns `RepositoryError::DatabaseError` if the database operation fails.
|
||||
async fn save_label(&self, id: RelayId, label: RelayLabel) -> Result<(), RepositoryError>;
|
||||
|
||||
/// Deletes the label for a specific relay.
|
||||
///
|
||||
/// If no label exists for the relay, this operation succeeds without error.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns `RepositoryError::DatabaseError` if the database operation fails.
|
||||
async fn delete_label(&self, id: RelayId) -> Result<(), RepositoryError>;
|
||||
|
||||
/// Retrieves all relay labels from the repository.
|
||||
///
|
||||
/// Returns a vector of tuples containing relay IDs and their corresponding labels.
|
||||
|
||||
Reference in New Issue
Block a user