add unit testing for ServiceConfig::register()

This commit is contained in:
RuangyotN 2025-03-24 22:01:58 +07:00
parent 5e9715e92d
commit 91caca1272

View file

@ -152,7 +152,7 @@ mod tests {
use crate::http::{Method, StatusCode};
use crate::util::Bytes;
use crate::web::test::{call_service, init_service, read_body, TestRequest};
use crate::web::{self, App, HttpRequest, HttpResponse};
use crate::web::{self, App, DefaultError, HttpRequest, HttpResponse};
#[crate::rt_test]
async fn test_configure_state() {
@ -225,4 +225,11 @@ mod tests {
let resp = call_service(&srv, req).await;
assert_eq!(resp.status(), StatusCode::OK);
}
#[test]
fn test_service_config_register() {
let cfg: ServiceConfig<DefaultError> = ServiceConfig::register();
assert!(cfg.services.is_empty());
assert!(cfg.external.is_empty());
}
}