footing 0.1.9

Feature-gated foundations for Rust backend services
Documentation
//! SQLite test configuration helpers.

use crate::db::sqlite::{SqliteBootstrapSettings, SqlitePoolSettings};

#[must_use]
/// Creates deterministic single-connection, migration-free in-memory SQLite settings.
pub fn in_memory_settings() -> SqliteBootstrapSettings {
    SqliteBootstrapSettings::new("sqlite::memory:")
        .with_pool(SqlitePoolSettings::default().with_max_connections(1))
}

#[cfg(test)]
mod tests {
    #[test]
    fn in_memory_defaults_are_isolated_and_connectable() {
        let config = super::in_memory_settings()
            .build()
            .expect("test settings should be valid");

        assert_eq!(config.connection_config().database_url(), "sqlite::memory:");
        assert_eq!(config.pool_config().max_connections(), 1);
        assert!(!config.migrate_on_startup());
    }
}