-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test Directory and test_config.rs
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} |