🚧 Prepare code for testing
This commit is contained in:
parent
916e5d3300
commit
d7762a10fa
8 changed files with 80 additions and 71 deletions
2
pagetop/tests/main.rs
Normal file
2
pagetop/tests/main.rs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#[cfg(test)]
|
||||
mod server;
|
||||
20
pagetop/tests/server/health_check.rs
Normal file
20
pagetop/tests/server/health_check.rs
Normal 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");
|
||||
}
|
||||
1
pagetop/tests/server/mod.rs
Normal file
1
pagetop/tests/server/mod.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
mod health_check;
|
||||
Loading…
Add table
Add a link
Reference in a new issue