Added test body_to_str_not_empty
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
cb9d1d50fd
commit
a949f196c8
11
src/main.rs
11
src/main.rs
@ -56,7 +56,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
}
|
||||
|
||||
#[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)));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user