diff --git a/crates/store/tests/test_calendar.rs b/crates/store/tests/test_calendar.rs index a40fdd7..64bde0b 100644 --- a/crates/store/tests/test_calendar.rs +++ b/crates/store/tests/test_calendar.rs @@ -1,14 +1,17 @@ use rstest::rstest; use rstest_reuse::{self, apply, template}; use rustical_store::{CalendarObject, CalendarStore}; -use rustical_store_sqlite::create_test_store; +use rustical_store_sqlite::{calendar_store::SqliteCalendarStore, create_test_db}; const TIMEZONE: &str = include_str!("examples/timezone.ics"); const EVENT: &str = include_str!("examples/event.ics"); #[template] #[rstest] -#[case::sqlite(async {create_test_store().await.unwrap() })] +#[case::sqlite(async { + let (send, _recv) = tokio::sync::mpsc::channel(100); + SqliteCalendarStore::new(create_test_db().await.unwrap(), send) +})] async fn cal_store( #[future(awt)] #[case] diff --git a/crates/store_sqlite/src/lib.rs b/crates/store_sqlite/src/lib.rs index a53c314..80d9055 100644 --- a/crates/store_sqlite/src/lib.rs +++ b/crates/store_sqlite/src/lib.rs @@ -43,8 +43,12 @@ pub async fn create_db_pool(db_url: &str, migrate: bool) -> Result, Ok(db) } -pub async fn create_test_store() -> Result { +pub async fn create_test_db() -> Result { let db = SqlitePool::connect("sqlite::memory:").await?; sqlx::migrate!("./migrations").run(&db).await?; - Ok(SqliteStore::new(db)) + Ok(db) +} + +pub async fn create_test_store() -> Result { + Ok(SqliteStore::new(create_test_db().await?)) }