Skip to content

Commit

Permalink
Add test Directory and test_config.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
0xIchigo committed Apr 18, 2024
1 parent 97c096b commit ca936e0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use helius_rust_sdk::config::Config;
use helius_rust_sdk::types::Cluster;
use helius_rust_sdk::error::HeliusError;

#[test]
fn test_config_new_with_empty_api_key() {
let result: Result<Config, HeliusError> = Config::new("", Cluster::Devnet);
assert!(matches!(result, Err(HeliusError::InvalidInput(_))));
}

#[test]
fn test_config_new_with_valid_api_key() {
let result: Result<Config, HeliusError> = Config::new("valid-api-key", Cluster::Devnet);
assert!(result.is_ok());

let config = result.unwrap();
assert_eq!(config.api_key, "valid-api-key");
assert_eq!(config.endpoints.api, "https://api-devnet.helius-rpc.com");
assert_eq!(config.endpoints.rpc, "https://devnet.helius-rpc.com");
}

0 comments on commit ca936e0

Please sign in to comment.