Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryardley committed Dec 7, 2024
1 parent ae50d13 commit ff06185
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/ciphernode/evm/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,30 +225,32 @@ mod test {
use super::*;

#[test]
fn test_rpc_type_conversion() {
fn test_rpc_type_conversion() -> Result<()> {
// Test HTTP URLs
let http = RPC::from_url("http://localhost:8545/").unwrap();
assert!(matches!(http, RPC::Http(_)));
assert_eq!(http.as_http_url(), "http://localhost:8545/");
assert_eq!(http.as_ws_url(), "ws://localhost:8545/");
assert_eq!(http.as_http_url()?, "http://localhost:8545/");
assert_eq!(http.as_ws_url()?, "ws://localhost:8545/");

// Test HTTPS URLs
let https = RPC::from_url("https://example.com/").unwrap();
assert!(matches!(https, RPC::Https(_)));
assert_eq!(https.as_http_url(), "https://example.com/");
assert_eq!(https.as_ws_url(), "wss://example.com/");
assert_eq!(https.as_http_url()?, "https://example.com/");
assert_eq!(https.as_ws_url()?, "wss://example.com/");

// Test WS URLs
let ws = RPC::from_url("ws://localhost:8545/").unwrap();
assert!(matches!(ws, RPC::Ws(_)));
assert_eq!(ws.as_http_url(), "http://localhost:8545/");
assert_eq!(ws.as_ws_url(), "ws://localhost:8545/");
assert_eq!(ws.as_http_url()?, "http://localhost:8545/");
assert_eq!(ws.as_ws_url()?, "ws://localhost:8545/");

// Test WSS URLs
let wss = RPC::from_url("wss://example.com/").unwrap();
assert!(matches!(wss, RPC::Wss(_)));
assert_eq!(wss.as_http_url(), "https://example.com/");
assert_eq!(wss.as_ws_url(), "wss://example.com/");
assert_eq!(wss.as_http_url()?, "https://example.com/");
assert_eq!(wss.as_ws_url()?, "wss://example.com/");

Ok(())
}

#[test]
Expand Down

0 comments on commit ff06185

Please sign in to comment.