chore: add Debug to CKAN struct and test with refactor

As per https://rust-lang.github.io/api-guidelines/debuggability.html#c-debug.
This commit is contained in:
rzmk 2025-12-25 23:36:18 -05:00
parent baf875e177
commit 614ebfbc05
2 changed files with 23 additions and 20 deletions

View file

@ -8,6 +8,7 @@ use bon::bon;
use serde_json::json; use serde_json::json;
use std::{collections::HashMap, path::PathBuf}; use std::{collections::HashMap, path::PathBuf};
#[derive(Debug)]
pub struct CKAN { pub struct CKAN {
url: String, url: String,
token: Option<String>, token: Option<String>,

View file

@ -10,10 +10,6 @@ pub async fn get_ckan_builder() -> CKAN {
.build() .build()
} }
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test] #[tokio::test]
#[ignore = "Set values for const at top of tests file locally."] #[ignore = "Set values for const at top of tests file locally."]
async fn status_show() -> Result<(), Box<dyn std::error::Error>> { async fn status_show() -> Result<(), Box<dyn std::error::Error>> {
@ -30,4 +26,10 @@ mod tests {
assert!(success); assert!(success);
Ok(()) Ok(())
} }
#[tokio::test]
async fn print_ckan_struct_with_debug() -> Result<(), Box<dyn std::error::Error>> {
let ckan = get_ckan_builder().await;
assert_eq!(format!("{ckan:?}"), r#"CKAN { url: "", token: Some("") }"#);
Ok(())
} }