From e9a5136c8dab978aa0d17c5db57b0da62cab5798 Mon Sep 17 00:00:00 2001 From: Alex Wellnitz Date: Thu, 19 Dec 2024 11:31:27 +0100 Subject: [PATCH] refactor: type config tests --- src/types/config.rs | 8 ++++---- tests/config_type_tests.rs | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/types/config.rs b/src/types/config.rs index 42392ad..9517094 100644 --- a/src/types/config.rs +++ b/src/types/config.rs @@ -4,8 +4,8 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] pub struct Config { - http_addr: String, - database_path: String, + pub http_addr: String, + pub database_path: String, } impl Config { @@ -16,8 +16,8 @@ impl Config { } } - pub(crate) fn load_from_file(_config_path: &str) -> Result { - unimplemented!(); + pub fn load_from_file(_config_path: &str) -> Result { + todo!(); } } diff --git a/tests/config_type_tests.rs b/tests/config_type_tests.rs index a1ebea4..edf9647 100644 --- a/tests/config_type_tests.rs +++ b/tests/config_type_tests.rs @@ -3,12 +3,11 @@ mod tests { use rustysearch::types::config::Config; #[test] - fn test_search_engine() { + fn test_create_new_config() { let config = Config::default(); let config_two = Config::new(); - println!("{:?}", config); - println!("{:?}", config_two); - // assert_eq!(config.http, 1); + assert_eq!(config.http_addr, "127.0.0.1:4000"); + assert_eq!(config_two.http_addr, "127.0.0.1:4000"); } }