handlers: image/reindex/auth via use cases; auth::authenticate replaces ensure_active; check-handler-services guard
All checks were successful
CI / Check / Test (push) Successful in 1h10m22s

This commit is contained in:
2026-10-26 10:51:32 +01:00
parent 017b58d6fa
commit 00395357ac
30 changed files with 275 additions and 96 deletions

View File

@@ -0,0 +1,33 @@
use domain::{
errors::DomainError,
events::DomainEvent,
testing::{NoopEventPublisher, RefusingEventPublisher},
};
use application::search::{deps::RequestReindexDeps, request_reindex};
#[tokio::test]
async fn publishes_a_reindex_request() {
let publisher = NoopEventPublisher::new();
let deps = RequestReindexDeps {
event_publisher: publisher.clone(),
};
request_reindex::execute(&deps).await.unwrap();
assert!(matches!(
publisher.published().as_slice(),
[DomainEvent::SearchReindexRequested]
));
}
#[tokio::test]
async fn a_publish_failure_is_returned() {
let deps = RequestReindexDeps {
event_publisher: std::sync::Arc::new(RefusingEventPublisher),
};
let err = request_reindex::execute(&deps).await.unwrap_err();
assert!(matches!(err, DomainError::InfrastructureError(_)));
}