From 1200b8a203c5401183d05fc9b9522be8a3f4dd58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fri=C3=B0rik=20=C3=81smundsson?= Date: Mon, 20 Nov 2023 17:38:31 +0000 Subject: [PATCH] fix test failure when running cargo test (#1928) Running `cargo test` seems to non-deterministically select different networks causing the Address test_debug() test to fail --- shared/src/address/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/shared/src/address/mod.rs b/shared/src/address/mod.rs index e86cb306a..10d6ea970 100644 --- a/shared/src/address/mod.rs +++ b/shared/src/address/mod.rs @@ -397,10 +397,12 @@ mod tests { #[test] fn test_debug() { - assert_eq!( - "Address(\"f01\")", - format!("{:?}", super::Address::new_id(1)) - ) + // the address string is dependent on current network state which is set + // globally so we need to check against possible valid options + let addr_debug_str = format!("{:?}", super::Address::new_id(1)); + assert!(["Address(\"f01\")", "Address(\"t01\")"] + .iter() + .any(|&s| s == addr_debug_str)); } #[test]