Skip to content

Commit

Permalink
fix test failure when running cargo test (#1928)
Browse files Browse the repository at this point in the history
Running `cargo test` seems to non-deterministically select different
networks causing the Address test_debug() test to fail
  • Loading branch information
fridrik01 authored Nov 20, 2023
1 parent f631076 commit 1200b8a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions shared/src/address/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 1200b8a

Please sign in to comment.