diff --git a/src/main.rs b/src/main.rs index 1cef7db..14b7769 100644 --- a/src/main.rs +++ b/src/main.rs @@ -56,7 +56,7 @@ async fn main() -> Result<(), Box> { } #[cfg(test)] -mod tests { +mod tests_main { use hyper::{Body, Response}; use crate::body_to_str; @@ -66,4 +66,13 @@ mod tests { assert_eq!("", tokio_test::block_on(body_to_str(res))); } + #[test] + fn body_to_str_not_empty() { + let res = Response::new(Body::from("demo")); + assert_eq!("demo", tokio_test::block_on(body_to_str(res))); + + let res2 = Response::new(Body::from("hello world")); + assert_eq!("hello world", tokio_test::block_on(body_to_str(res2))); + } + }