From 8b021f828ff2c5bc9e202d46b8d3db6d4e66cd8d Mon Sep 17 00:00:00 2001 From: Namekuji Date: Fri, 2 Jun 2023 16:34:45 -0400 Subject: [PATCH] fix unit tests --- .../backend/native-utils/src/model/schema/antenna.rs | 9 ++++++++- packages/backend/native-utils/src/util/id.rs | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/backend/native-utils/src/model/schema/antenna.rs b/packages/backend/native-utils/src/model/schema/antenna.rs index 198230e9a..00f1216ac 100644 --- a/packages/backend/native-utils/src/model/schema/antenna.rs +++ b/packages/backend/native-utils/src/model/schema/antenna.rs @@ -119,6 +119,7 @@ cfg_if! { #[cfg(test)] mod unit_test { + use cfg_if::cfg_if; use pretty_assertions::assert_eq; use serde_json::json; @@ -129,7 +130,13 @@ mod unit_test { #[test] fn src_from_active_enum() { let src = AntennaSrc::try_from(AntennaSrcEnum::All).unwrap(); - assert_eq!(src, AntennaSrc::All); + cfg_if! { + if #[cfg(feature = "napi")] { + assert_eq!(src, AntennaSrc::all); + } else { + assert_eq!(src, AntennaSrc::All); + } + } } #[test] diff --git a/packages/backend/native-utils/src/util/id.rs b/packages/backend/native-utils/src/util/id.rs index b8bf54747..b17b112d7 100644 --- a/packages/backend/native-utils/src/util/id.rs +++ b/packages/backend/native-utils/src/util/id.rs @@ -91,7 +91,7 @@ mod unit_test { assert_ne!(id::create_id().unwrap(), id::create_id().unwrap()); let id1 = 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()); } } }