code refactor
Some checks failed
CI / Check / Test (push) Has been cancelled

Reviewed-on: #26
This commit was merged in pull request #26.
This commit is contained in:
2026-10-26 09:36:23 +00:00
parent 2ce7db12c2
commit 017b58d6fa
804 changed files with 33423 additions and 28955 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());
}