Skip to content

Commit

Permalink
cli: Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto committed Dec 14, 2024
1 parent 1f75ec9 commit b50dd42
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1484,15 +1484,34 @@ mod tests {
wallet = \"id.json\"
";

const CUSTOM_CONFIG: &str = "
#[test]
fn parse_custom_cluster_str() {
let config = Config::from_str(
"
[provider]
cluster = { http = \"http://my-url.com\", ws = \"ws://my-url.com\" }
cluster = \"http://my-url.com\"
wallet = \"id.json\"
";
",
)
.unwrap();
assert!(!config.features.skip_lint);

// Make sure the layout of `provider.cluster` stays the same after serialization
assert!(config
.to_string()
.contains(r#"cluster = "http://my-url.com""#));
}

#[test]
fn parse_custom_cluster() {
let config = Config::from_str(CUSTOM_CONFIG).unwrap();
fn parse_custom_cluster_map() {
let config = Config::from_str(
"
[provider]
cluster = { http = \"http://my-url.com\", ws = \"ws://my-url.com\" }
wallet = \"id.json\"
",
)
.unwrap();
assert!(!config.features.skip_lint);
}

Expand Down

0 comments on commit b50dd42

Please sign in to comment.