mirror of
https://github.com/danbulant/Portfolio
synced 2026-07-05 11:00:56 +00:00
feat: test util function under cfg(test)
This commit is contained in:
parent
75e3ccdcd5
commit
787b234048
1 changed files with 7 additions and 4 deletions
|
|
@ -1,6 +1,4 @@
|
||||||
use entity::{admin, candidate, parent, session};
|
use sea_orm::DbConn;
|
||||||
use sea_orm::{Schema, Database, DbConn};
|
|
||||||
use sea_orm::{sea_query::TableCreateStatement, ConnectionTrait, DbBackend};
|
|
||||||
|
|
||||||
use crate::Query;
|
use crate::Query;
|
||||||
use crate::error::ServiceError;
|
use crate::error::ServiceError;
|
||||||
|
|
@ -12,8 +10,13 @@ pub async fn get_recipients(db: &DbConn, candidate_pubkey: &str) -> Result<Vec<S
|
||||||
Ok(recipients)
|
Ok(recipients)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
pub async fn get_memory_sqlite_connection() -> sea_orm::DbConn {
|
pub async fn get_memory_sqlite_connection() -> sea_orm::DbConn {
|
||||||
|
use entity::{admin, candidate, parent, session};
|
||||||
|
use sea_orm::{Schema, Database};
|
||||||
|
use sea_orm::{sea_query::TableCreateStatement, ConnectionTrait, DbBackend};
|
||||||
|
|
||||||
|
|
||||||
let base_url = "sqlite::memory:";
|
let base_url = "sqlite::memory:";
|
||||||
let db: DbConn = Database::connect(base_url).await.unwrap();
|
let db: DbConn = Database::connect(base_url).await.unwrap();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue