🚧 Prepare code for testing

This commit is contained in:
Manuel Cillero 2023-10-26 08:50:18 +02:00
parent 916e5d3300
commit d7762a10fa
8 changed files with 80 additions and 71 deletions

2
pagetop/tests/main.rs Normal file
View file

@ -0,0 +1,2 @@
#[cfg(test)]
mod server;

View file

@ -0,0 +1,20 @@
use pagetop::prelude::*;
new_handle!(MODULE_TEST_SERVER_HEALTH_CHECK);
struct HealthCheck;
impl ModuleTrait for HealthCheck {
fn handle(&self) -> Handle {
MODULE_TEST_SERVER_HEALTH_CHECK
}
}
#[pagetop::test]
async fn health_check_works() {
let app = service::test::init_service(Application::prepare(&HealthCheck).unwrap().test()).await;
let req = service::test::TestRequest::get().uri("/").to_request();
let _resp = service::test::call_service(&app, req).await;
// assert_eq!("OK", "OK");
}

View file

@ -0,0 +1 @@
mod health_check;