From ca936e01f2552b164b9cb4d25796a28aa46c892f Mon Sep 17 00:00:00 2001 From: Evan <0xIchigo@protonmail.com> Date: Wed, 17 Apr 2024 20:16:28 -0400 Subject: [PATCH] Add test Directory and test_config.rs --- tests/test_config.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/test_config.rs diff --git a/tests/test_config.rs b/tests/test_config.rs new file mode 100644 index 0000000..93aecb4 --- /dev/null +++ b/tests/test_config.rs @@ -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::new("", Cluster::Devnet); + assert!(matches!(result, Err(HeliusError::InvalidInput(_)))); +} + +#[test] +fn test_config_new_with_valid_api_key() { + let result: Result = 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"); +} \ No newline at end of file