use std::sync::Arc;
use crate::sqlite::{SqliteWorkStore, open_for_tests};
impl aidaemon_channels::hub::SessionChannelStore for SqliteWorkStore {}
pub(crate) async fn test_store() -> Arc<SqliteWorkStore> {
let db_file = tempfile::NamedTempFile::new().unwrap();
let store = open_for_tests(db_file.path().to_str().unwrap()).await;
aidaemon_tools::testing::delete_at_exit(db_file.into_temp_path().keep().unwrap());
Arc::new(store)
}
pub(crate) struct TestHarness {
pub(crate) state: Arc<SqliteWorkStore>,
}
impl TestHarness {
pub(crate) async fn new() -> Self {
Self {
state: test_store().await,
}
}
}