From 80a5c9dcbfa9a4616f2f5897d4a7b5be9a5528b1 Mon Sep 17 00:00:00 2001 From: Evan <0xIchigo@protonmail.com> Date: Thu, 28 Nov 2024 16:53:45 -0500 Subject: [PATCH] Add More Config Tests --- tests/test_config.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_config.rs b/tests/test_config.rs index 75568aa5..83f99e39 100644 --- a/tests/test_config.rs +++ b/tests/test_config.rs @@ -1,6 +1,7 @@ use helius::config::Config; use helius::error::{HeliusError, Result}; use helius::types::Cluster; +use helius::Helius; #[test] fn test_config_new_with_empty_api_key() { @@ -18,3 +19,25 @@ fn test_config_new_with_valid_api_key() { assert_eq!(config.endpoints.api, "https://api-devnet.helius-rpc.com/"); assert_eq!(config.endpoints.rpc, "https://devnet.helius-rpc.com/"); } + +#[test] +fn test_create_basic_client() { + let config: Config = Config::new("valid-api-key", Cluster::Devnet).unwrap(); + let result: Result = config.create_client(); + assert!(result.is_ok()); + + let client: Helius = result.unwrap(); + assert!(client.async_rpc_client.is_none()); + assert!(client.ws_client.is_none()); +} + +#[test] +fn test_create_async_client() { + let config: Config = Config::new("valid-api-key", Cluster::Devnet).unwrap(); + let result: Result = config.create_client_with_async(); + assert!(result.is_ok()); + + let client: Helius = result.unwrap(); + assert!(client.async_rpc_client.is_some()); + assert!(client.ws_client.is_none()); +}