mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 18:12:27 +00:00
store: test preparations
This commit is contained in:
@@ -11,6 +11,9 @@ mod secret;
|
|||||||
mod subscription_store;
|
mod subscription_store;
|
||||||
pub mod synctoken;
|
pub mod synctoken;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
pub mod tests;
|
||||||
|
|
||||||
pub use addressbook_store::AddressbookStore;
|
pub use addressbook_store::AddressbookStore;
|
||||||
pub use calendar_store::CalendarStore;
|
pub use calendar_store::CalendarStore;
|
||||||
pub use combined_calendar_store::CombinedCalendarStore;
|
pub use combined_calendar_store::CombinedCalendarStore;
|
||||||
|
|||||||
0
crates/store/src/tests/mod.rs
Normal file
0
crates/store/src/tests/mod.rs
Normal file
@@ -8,6 +8,9 @@ pub mod error;
|
|||||||
pub mod principal_store;
|
pub mod principal_store;
|
||||||
pub mod subscription_store;
|
pub mod subscription_store;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
pub mod tests;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, sqlx::Type)]
|
#[derive(Debug, Clone, Serialize, sqlx::Type)]
|
||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
pub(crate) enum ChangeOperation {
|
pub(crate) enum ChangeOperation {
|
||||||
@@ -42,13 +45,3 @@ pub async fn create_db_pool(db_url: &str, migrate: bool) -> Result<Pool<Sqlite>,
|
|||||||
}
|
}
|
||||||
Ok(db)
|
Ok(db)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create_test_db() -> Result<SqlitePool, sqlx::Error> {
|
|
||||||
let db = SqlitePool::connect("sqlite::memory:").await?;
|
|
||||||
sqlx::migrate!("./migrations").run(&db).await?;
|
|
||||||
Ok(db)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn create_test_store() -> Result<SqliteStore, sqlx::Error> {
|
|
||||||
Ok(SqliteStore::new(create_test_db().await?))
|
|
||||||
}
|
|
||||||
|
|||||||
13
crates/store_sqlite/src/tests/mod.rs
Normal file
13
crates/store_sqlite/src/tests/mod.rs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
use crate::SqliteStore;
|
||||||
|
use sqlx::SqlitePool;
|
||||||
|
|
||||||
|
pub async fn create_test_db() -> Result<SqlitePool, sqlx::Error> {
|
||||||
|
let db = SqlitePool::connect("sqlite::memory:").await?;
|
||||||
|
sqlx::migrate!("./migrations").run(&db).await?;
|
||||||
|
Ok(db)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn test_create_store() {
|
||||||
|
SqliteStore::new(create_test_db().await.unwrap());
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user