Compare commits

...

2 Commits

Author SHA1 Message Date
980bcff1d9 Merge pull request 'fix tests' (#791) from formating-ergo into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 10m47s
CI/CD Pipeline / deploy-staging (push) Successful in 18m56s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #791
2024-11-11 15:27:15 +01:00
d7eaa14e55 fix tests
Some checks failed
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
2024-11-11 15:26:33 +01:00
2 changed files with 16 additions and 4 deletions

View File

@ -463,7 +463,13 @@ WHERE trip_details.id=?
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use crate::{model::tripdetails::TripDetails, testdb}; use crate::{
model::{
tripdetails::TripDetails,
user::{EventUser, User},
},
testdb,
};
use super::Event; use super::Event;
use chrono::Local; use chrono::Local;
@ -483,7 +489,10 @@ mod test {
let trip_details = TripDetails::find_by_id(&pool, 1).await.unwrap(); let trip_details = TripDetails::find_by_id(&pool, 1).await.unwrap();
Event::create(&pool, "new-event".into(), 2, false, &trip_details).await; let admin = EventUser::new(&pool, User::find_by_id(&pool, 1).await.unwrap())
.await
.unwrap();
Event::create(&pool, &admin, "new-event".into(), 2, false, &trip_details).await;
let res = Event::get_for_day(&pool, Local::now().date_naive()).await; let res = Event::get_for_day(&pool, Local::now().date_naive()).await;
assert_eq!(res.len(), 2); assert_eq!(res.len(), 2);

View File

@ -221,7 +221,7 @@ mod test {
notification::Notification, notification::Notification,
trip::Trip, trip::Trip,
tripdetails::{TripDetails, TripDetailsToAdd}, tripdetails::{TripDetails, TripDetailsToAdd},
user::{SteeringUser, User}, user::{EventUser, SteeringUser, User},
usertrip::UserTrip, usertrip::UserTrip,
}, },
testdb, testdb,
@ -247,7 +247,10 @@ mod test {
let trip_details = TripDetails::find_by_id(&pool, tripdetails_id) let trip_details = TripDetails::find_by_id(&pool, tripdetails_id)
.await .await
.unwrap(); .unwrap();
Event::create(&pool, "new-event".into(), 2, false, &trip_details).await; let user = EventUser::new(&pool, User::find_by_id(&pool, 1).await.unwrap())
.await
.unwrap();
Event::create(&pool, &user, "new-event".into(), 2, false, &trip_details).await;
let event = Event::find_by_trip_details(&pool, trip_details.id) let event = Event::find_by_trip_details(&pool, trip_details.id)
.await .await
.unwrap(); .unwrap();