style: cargo fmt --all
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
use std::sync::Arc;
|
||||
use application::catalog::{GetAssetQuery, GetAssetHandler};
|
||||
use application::testing::{InMemoryAssetRepository, InMemoryAssetMetadataRepository};
|
||||
use application::catalog::{GetAssetHandler, GetAssetQuery};
|
||||
use application::testing::{InMemoryAssetMetadataRepository, InMemoryAssetRepository};
|
||||
use domain::catalog::entities::{Asset, AssetMetadata, AssetType, MetadataSource, SourceReference};
|
||||
use domain::errors::DomainError;
|
||||
use domain::ports::{AssetRepository, AssetMetadataRepository};
|
||||
use domain::ports::{AssetMetadataRepository, AssetRepository};
|
||||
use domain::value_objects::{Checksum, MetadataValue, StructuredData, SystemId};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tokio::test]
|
||||
async fn returns_asset_with_resolved_metadata() {
|
||||
@@ -16,7 +16,13 @@ async fn returns_asset_with_resolved_metadata() {
|
||||
relative_path: "photos/img.jpg".into(),
|
||||
checksum: Checksum::new("a".repeat(64)).unwrap(),
|
||||
};
|
||||
let asset = Asset::new(source, AssetType::Image, "image/jpeg", 1024, SystemId::new());
|
||||
let asset = Asset::new(
|
||||
source,
|
||||
AssetType::Image,
|
||||
"image/jpeg",
|
||||
1024,
|
||||
SystemId::new(),
|
||||
);
|
||||
asset_repo.save(&asset).await.unwrap();
|
||||
|
||||
// Add exif layer
|
||||
@@ -33,9 +39,12 @@ async fn returns_asset_with_resolved_metadata() {
|
||||
meta_repo.save(&user_meta).await.unwrap();
|
||||
|
||||
let handler = GetAssetHandler::new(asset_repo, meta_repo);
|
||||
let (returned, resolved) = handler.execute(GetAssetQuery {
|
||||
asset_id: asset.asset_id,
|
||||
}).await.unwrap();
|
||||
let (returned, resolved) = handler
|
||||
.execute(GetAssetQuery {
|
||||
asset_id: asset.asset_id,
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(returned.asset_id, asset.asset_id);
|
||||
// UserEdited overrides ExifExtracted
|
||||
@@ -50,9 +59,11 @@ async fn rejects_nonexistent() {
|
||||
let meta_repo = Arc::new(InMemoryAssetMetadataRepository::new());
|
||||
|
||||
let handler = GetAssetHandler::new(asset_repo, meta_repo);
|
||||
let result = handler.execute(GetAssetQuery {
|
||||
asset_id: SystemId::new(),
|
||||
}).await;
|
||||
let result = handler
|
||||
.execute(GetAssetQuery {
|
||||
asset_id: SystemId::new(),
|
||||
})
|
||||
.await;
|
||||
|
||||
assert!(matches!(result, Err(DomainError::NotFound(_))));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user