fix unit tests

This commit is contained in:
Namekuji 2023-06-02 16:34:45 -04:00
parent c443a5601c
commit 7cf2b39cde
No known key found for this signature in database
GPG Key ID: B541BD6E646CABC7
2 changed files with 9 additions and 2 deletions

View File

@ -119,6 +119,7 @@ cfg_if! {
#[cfg(test)] #[cfg(test)]
mod unit_test { mod unit_test {
use cfg_if::cfg_if;
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
use serde_json::json; use serde_json::json;
@ -129,8 +130,14 @@ mod unit_test {
#[test] #[test]
fn src_from_active_enum() { fn src_from_active_enum() {
let src = AntennaSrc::try_from(AntennaSrcEnum::All).unwrap(); let src = AntennaSrc::try_from(AntennaSrcEnum::All).unwrap();
cfg_if! {
if #[cfg(feature = "napi")] {
assert_eq!(src, AntennaSrc::all);
} else {
assert_eq!(src, AntennaSrc::All); assert_eq!(src, AntennaSrc::All);
} }
}
}
#[test] #[test]
fn antenna_valid() { fn antenna_valid() {

View File

@ -91,7 +91,7 @@ mod unit_test {
assert_ne!(id::create_id().unwrap(), id::create_id().unwrap()); assert_ne!(id::create_id().unwrap(), id::create_id().unwrap());
let id1 = thread::spawn(|| id::create_id().unwrap()); let id1 = thread::spawn(|| id::create_id().unwrap());
let id2 = thread::spawn(|| id::create_id().unwrap()); let id2 = thread::spawn(|| id::create_id().unwrap());
assert_ne!(id1.join().unwrap(), id2.join().unwrap()) assert_ne!(id1.join().unwrap(), id2.join().unwrap());
} }
} }
} }