style: cargo fmt --all

This commit is contained in:
2026-05-31 05:31:42 +02:00
parent 4b31a0f74b
commit c2ebca0da0
138 changed files with 2422 additions and 1164 deletions

View File

@@ -1,8 +1,11 @@
use std::sync::Arc;
use application::testing::{InMemoryStorageVolumeRepository, InMemoryLibraryPathRepository};
use application::storage::{RegisterVolumeCommand, RegisterVolumeHandler, RegisterLibraryPathCommand, RegisterLibraryPathHandler};
use application::storage::{
RegisterLibraryPathCommand, RegisterLibraryPathHandler, RegisterVolumeCommand,
RegisterVolumeHandler,
};
use application::testing::{InMemoryLibraryPathRepository, InMemoryStorageVolumeRepository};
use domain::errors::DomainError;
use domain::value_objects::SystemId;
use std::sync::Arc;
#[tokio::test]
async fn creates_path() {
@@ -10,20 +13,26 @@ async fn creates_path() {
let path_repo = Arc::new(InMemoryLibraryPathRepository::new());
let vol_handler = RegisterVolumeHandler::new(vol_repo.clone());
let vol = vol_handler.execute(RegisterVolumeCommand {
volume_name: "main".into(),
uri_prefix: "file:///data".into(),
is_writable: true,
}).await.unwrap();
let vol = vol_handler
.execute(RegisterVolumeCommand {
volume_name: "main".into(),
uri_prefix: "file:///data".into(),
is_writable: true,
})
.await
.unwrap();
let handler = RegisterLibraryPathHandler::new(vol_repo, path_repo);
let owner = SystemId::new();
let path = handler.execute(RegisterLibraryPathCommand {
volume_id: vol.volume_id,
relative_path: "photos/inbox".into(),
owner_id: owner,
is_ingest_destination: true,
}).await.unwrap();
let path = handler
.execute(RegisterLibraryPathCommand {
volume_id: vol.volume_id,
relative_path: "photos/inbox".into(),
owner_id: owner,
is_ingest_destination: true,
})
.await
.unwrap();
assert_eq!(path.volume_id, vol.volume_id);
assert_eq!(path.relative_path, "photos/inbox");
@@ -37,11 +46,13 @@ async fn rejects_nonexistent_volume() {
let path_repo = Arc::new(InMemoryLibraryPathRepository::new());
let handler = RegisterLibraryPathHandler::new(vol_repo, path_repo);
let result = handler.execute(RegisterLibraryPathCommand {
volume_id: SystemId::new(),
relative_path: "photos/inbox".into(),
owner_id: SystemId::new(),
is_ingest_destination: true,
}).await;
let result = handler
.execute(RegisterLibraryPathCommand {
volume_id: SystemId::new(),
relative_path: "photos/inbox".into(),
owner_id: SystemId::new(),
is_ingest_destination: true,
})
.await;
assert!(matches!(result, Err(DomainError::NotFound(_))));
}