fix backend tests

This commit is contained in:
2024-09-02 13:35:12 +03:00
parent 6b88927880
commit 2dc145e697
6 changed files with 27 additions and 23 deletions

View File

@ -191,7 +191,7 @@ pub fn routes() -> Vec<Route> {
#[cfg(test)]
mod test {
use chrono::NaiveDate;
use chrono::{Local, NaiveDate};
use rocket::{
http::{ContentType, Status},
local::asynchronous::Client,
@ -252,7 +252,9 @@ mod test {
fn test_trip_update_succ() {
let db = testdb!();
let trip = &Trip::get_for_day(&db, NaiveDate::from_ymd_opt(1970, 01, 02).unwrap()).await[0];
let tomorrow = Local::now().date_naive() + chrono::Duration::days(1);
println!("{tomorrow}");
let trip = &Trip::get_for_day(&db, tomorrow).await[0];
assert_eq!(1, trip.trip.max_people);
assert_eq!(
"trip_details for trip from cox",
@ -288,7 +290,8 @@ mod test {
"7:successAusfahrt erfolgreich aktualisiert."
);
let trip = &Trip::get_for_day(&db, NaiveDate::from_ymd_opt(1970, 01, 02).unwrap()).await[0];
let tomorrow = Local::now().date_naive() + chrono::Duration::days(1);
let trip = &Trip::get_for_day(&db, tomorrow).await[0];
assert_eq!(12, trip.trip.max_people);
assert_eq!("my-new-notes", &trip.trip.notes.clone().unwrap());
}
@ -328,7 +331,9 @@ mod test {
fn test_trip_update_wrong_cox() {
let db = testdb!();
let trip = &Trip::get_for_day(&db, NaiveDate::from_ymd_opt(1970, 01, 02).unwrap()).await[0];
let tomorrow = Local::now().date_naive() + chrono::Duration::days(1);
let trip = &Trip::get_for_day(&db, tomorrow).await[0];
assert_eq!(1, trip.trip.max_people);
assert_eq!(
"trip_details for trip from cox",