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,12 +1,11 @@
use std::sync::Arc;
use application::testing::{InMemoryShareRepository, StubEventPublisher};
use application::sharing::{
GenerateShareLinkCommand, GenerateShareLinkHandler,
RevokeShareCommand, RevokeShareHandler,
GenerateShareLinkCommand, GenerateShareLinkHandler, RevokeShareCommand, RevokeShareHandler,
};
use application::testing::{InMemoryShareRepository, StubEventPublisher};
use domain::entities::{LinkAccessLevel, ShareableType};
use domain::errors::DomainError;
use domain::value_objects::SystemId;
use std::sync::Arc;
#[tokio::test]
async fn revokes_share() {
@@ -15,20 +14,26 @@ async fn revokes_share() {
// Create a scope first via generate_share_link
let gen_handler = GenerateShareLinkHandler::new(share_repo.clone());
let (scope, _) = gen_handler.execute(GenerateShareLinkCommand {
shareable_type: ShareableType::Album,
shareable_id: SystemId::new(),
access_level: LinkAccessLevel::ViewOnly,
created_by: SystemId::new(),
expires_at: None,
max_uses: None,
}).await.unwrap();
let (scope, _) = gen_handler
.execute(GenerateShareLinkCommand {
shareable_type: ShareableType::Album,
shareable_id: SystemId::new(),
access_level: LinkAccessLevel::ViewOnly,
created_by: SystemId::new(),
expires_at: None,
max_uses: None,
})
.await
.unwrap();
let handler = RevokeShareHandler::new(share_repo, event_pub.clone());
handler.execute(RevokeShareCommand {
scope_id: scope.scope_id,
revoked_by: SystemId::new(),
}).await.unwrap();
handler
.execute(RevokeShareCommand {
scope_id: scope.scope_id,
revoked_by: SystemId::new(),
})
.await
.unwrap();
let events = event_pub.published().await;
assert_eq!(events.len(), 1);
@@ -40,9 +45,11 @@ async fn rejects_nonexistent_scope() {
let event_pub = Arc::new(StubEventPublisher::new());
let handler = RevokeShareHandler::new(share_repo, event_pub);
let result = handler.execute(RevokeShareCommand {
scope_id: SystemId::new(),
revoked_by: SystemId::new(),
}).await;
let result = handler
.execute(RevokeShareCommand {
scope_id: SystemId::new(),
revoked_by: SystemId::new(),
})
.await;
assert!(matches!(result, Err(DomainError::NotFound(_))));
}