Permet de modifier l'heure de début du chrono en cours
Champ « Début » sur le timer en cours (POST /ui/timer/debut) ; le chrono continue. Une heure dans le futur est refusée. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
092bc2fb3e
commit
35df6b52e8
4 files changed
+70
No files matched your search
@@ -665,3 +665,40 @@ async fn duplicate_entry() {
|
||||
let (status, _) = get_html(&app, "/ui/entries/99/dupliquer").await;
|
||||
assert_eq!(status, StatusCode::NOT_FOUND);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn move_timer_start() {
|
||||
let app = app().await;
|
||||
let p = project(&app, "Acme", "Site web").await;
|
||||
|
||||
let (status, _) = send_form(&app, "/ui/timer/debut", "started_at=2026-03-10T09%3A00").await;
|
||||
assert_eq!(status, StatusCode::CONFLICT, "no running timer");
|
||||
|
||||
let (status, _) = send_form(&app, "/ui/timer/start", &format!("project_id={p}")).await;
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
|
||||
let earlier = (Local::now() - chrono::Duration::minutes(90))
|
||||
.format("%Y-%m-%dT%H:%M")
|
||||
.to_string();
|
||||
let (status, html) = send_form(&app, "/ui/timer/debut", &format!("started_at={earlier}")).await;
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
assert!(html.contains(&earlier) && html.contains("Arrêter"));
|
||||
|
||||
let (_, timer) = send(&app, "GET", "/api/timer", None).await;
|
||||
let started =
|
||||
chrono::DateTime::parse_from_rfc3339(timer["started_at"].as_str().unwrap()).unwrap();
|
||||
assert_eq!(
|
||||
started
|
||||
.with_timezone(&Local)
|
||||
.format("%Y-%m-%dT%H:%M")
|
||||
.to_string(),
|
||||
earlier
|
||||
);
|
||||
assert!(timer["ended_at"].is_null(), "still running");
|
||||
|
||||
let future = (Local::now() + chrono::Duration::hours(1))
|
||||
.format("%Y-%m-%dT%H:%M")
|
||||
.to_string();
|
||||
let (status, _) = send_form(&app, "/ui/timer/debut", &format!("started_at={future}")).await;
|
||||
assert_eq!(status, StatusCode::UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
Reference in new issue
Block a user