add tests
This commit is contained in:
parent
4012d38f7f
commit
6bbfe1a6b4
|
@ -19,17 +19,10 @@ pub fn get_database() -> Result<&'static DatabaseConnection, Error> {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::get_database;
|
||||
use crate::{error::Error, init_database};
|
||||
use crate::error::Error;
|
||||
|
||||
#[test]
|
||||
fn unit_lib_error_uninitialized() {
|
||||
assert_eq!(get_database().unwrap_err(), Error::Uninitialized);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn unit_lib_connect_in_memory_sqlite() -> Result<(), Error> {
|
||||
init_database("sqlite::memory:").await?;
|
||||
get_database()?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
"prepublishOnly": "napi prepublish -t npm",
|
||||
"test": "ava",
|
||||
"universal": "napi universal",
|
||||
"version": "napi version"
|
||||
"version": "napi version",
|
||||
"cargo:unit": "cargo test --workspace unit",
|
||||
"cargo:integration": "cargo test --workspace inte -- --test-threads=1"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue