add tests

This commit is contained in:
Namekuji 2023-05-27 06:28:27 -04:00
parent 4012d38f7f
commit 6bbfe1a6b4
No known key found for this signature in database
GPG key ID: B541BD6E646CABC7
2 changed files with 4 additions and 9 deletions

View file

@ -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(())
}
}

View file

@ -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"
}
}