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
All checks were successful
CI / Check / Test (push) Successful in 1h10m22s
This commit is contained in:
33
crates/application/tests/search/request_reindex_test.rs
Normal file
33
crates/application/tests/search/request_reindex_test.rs
Normal 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(_)));
|
||||
}
|
||||
Reference in New Issue
Block a user