Skip to content

Commit

Permalink
Add More Config Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0xIchigo committed Nov 28, 2024
1 parent e35af6d commit 80a5c9d
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_config.rs
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -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<Helius> = 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<Helius> = 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());
}

0 comments on commit 80a5c9d

Please sign in to comment.