✅ Define la estructura para tests y ejemplos
This commit is contained in:
parent
cd76355430
commit
0af85c4d77
14 changed files with 74 additions and 24 deletions
18
tests/Cargo.toml
Normal file
18
tests/Cargo.toml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[package]
|
||||
name = "tests"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
|
||||
authors = [
|
||||
"Manuel Cillero <manuel@cillero.es>"
|
||||
]
|
||||
description = """\
|
||||
Test for PageTop.\
|
||||
"""
|
||||
homepage = "https://pagetop.cillero.es"
|
||||
repository = "https://github.com/manuelcillero/pagetop"
|
||||
license = "Apache-2.0 OR MIT"
|
||||
|
||||
[dependencies]
|
||||
actix-web = "4"
|
||||
pagetop = { version = "0.0", path = "../pagetop", features = ["mysql"], default-features = false }
|
||||
1
tests/src/main.rs
Normal file
1
tests/src/main.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
mod server;
|
||||
1
tests/src/server.rs
Normal file
1
tests/src/server.rs
Normal file
|
|
@ -0,0 +1 @@
|
|||
mod health_check;
|
||||
15
tests/src/server/health_check.rs
Normal file
15
tests/src/server/health_check.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
struct HealthCheck;
|
||||
|
||||
impl ModuleTrait for HealthCheck {}
|
||||
|
||||
async fn spawn_app() {
|
||||
let server = Application::prepare(&HealthCheck).unwrap().server();
|
||||
let _ = actix_web::rt::spawn(server);
|
||||
}
|
||||
|
||||
#[actix_web::test]
|
||||
async fn health_check_works() {
|
||||
spawn_app();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue