forked from jmug/stoatchat
feat(delta): test harness for web server
This commit is contained in:
@@ -25,7 +25,7 @@ pub fn mount(mut rocket: Rocket<Build>) -> Rocket<Build> {
|
||||
mount_endpoints_and_merged_docs! {
|
||||
rocket, "/".to_owned(), settings,
|
||||
"/" => (vec![], custom_openapi_spec()),
|
||||
"" => openapi_get_routes_spec![root::root, root::ping],
|
||||
"" => openapi_get_routes_spec![root::root],
|
||||
"/admin" => admin::routes(),
|
||||
"/users" => users::routes(),
|
||||
"/bots" => bots::routes(),
|
||||
@@ -46,7 +46,7 @@ pub fn mount(mut rocket: Rocket<Build>) -> Rocket<Build> {
|
||||
mount_endpoints_and_merged_docs! {
|
||||
rocket, "/".to_owned(), settings,
|
||||
"/" => (vec![], custom_openapi_spec()),
|
||||
"" => openapi_get_routes_spec![root::root, root::ping],
|
||||
"" => openapi_get_routes_spec![root::root],
|
||||
"/admin" => admin::routes(),
|
||||
"/users" => users::routes(),
|
||||
"/bots" => bots::routes(),
|
||||
|
||||
@@ -4,7 +4,6 @@ use revolt_quark::variables::delta::{
|
||||
};
|
||||
use revolt_quark::Result;
|
||||
|
||||
use rocket::http::Status;
|
||||
use rocket::serde::json::Json;
|
||||
use serde::Serialize;
|
||||
|
||||
@@ -138,9 +137,22 @@ pub async fn root() -> Result<Json<RevoltConfig>> {
|
||||
}))
|
||||
}
|
||||
|
||||
/// Example endpoint.
|
||||
#[openapi(skip)]
|
||||
#[get("/ping")]
|
||||
pub async fn ping(/*_limitguard: Ratelimiter*/) -> Status {
|
||||
Status::Ok
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use crate::rocket;
|
||||
use rocket::http::Status;
|
||||
|
||||
#[rocket::async_test]
|
||||
async fn hello_world() {
|
||||
let harness = crate::util::test::TestHarness::new().await;
|
||||
let response = harness.get("/").dispatch().await;
|
||||
assert_eq!(response.status(), Status::Ok);
|
||||
}
|
||||
|
||||
#[rocket::async_test]
|
||||
async fn hello_world_concurrent() {
|
||||
let harness = crate::util::test::TestHarness::new().await;
|
||||
let response = harness.get("/").dispatch().await;
|
||||
assert_eq!(response.status(), Status::Ok);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user