test: move application tests to tests/

test_support/test_helpers -> tests/support; watched_at unified w/ domain test_watched_at (2024-03-15).
Kept inline: users::diary_filter tests (feed_sort_to_direction_all_variants, paged_user_filter_builds_correctly) - pub(super) helpers in private module.
Dropped stale never-compiled users/tests/get_users.rs (old execute signature).
This commit is contained in:
2026-10-25 22:36:52 +01:00
parent a2c713c1fa
commit 8526b77f18
175 changed files with 541 additions and 695 deletions

View File

@@ -0,0 +1,43 @@
use chrono::NaiveDate;
use domain::models::wrapup::{WrapUpRecord, WrapUpStatus};
use domain::testing::InMemoryWrapUpRepository;
use domain::value_objects::WrapUpId;
use application::wrapup::deps::GetWrapUpDeps;
use application::wrapup::get_wrapup;
#[tokio::test]
async fn returns_record_when_exists() {
let repo = InMemoryWrapUpRepository::new();
let id = WrapUpId::generate();
repo.store.lock().unwrap().push(WrapUpRecord {
id: id.clone(),
user_id: None,
start_date: NaiveDate::from_ymd_opt(2024, 1, 1).unwrap(),
end_date: NaiveDate::from_ymd_opt(2025, 1, 1).unwrap(),
status: WrapUpStatus::Pending,
report: None,
error_message: None,
created_at: chrono::Utc::now().naive_utc(),
completed_at: None,
});
let deps = GetWrapUpDeps {
wrapup_repo: repo.clone(),
};
let result = get_wrapup::execute(&deps, id).await.unwrap();
assert!(result.is_some());
assert_eq!(result.unwrap().status, WrapUpStatus::Pending);
}
#[tokio::test]
async fn returns_none_when_missing() {
let repo = InMemoryWrapUpRepository::new();
let deps = GetWrapUpDeps {
wrapup_repo: repo.clone(),
};
let result = get_wrapup::execute(&deps, WrapUpId::generate())
.await
.unwrap();
assert!(result.is_none());
}