Skip to content

Commit

Permalink
Add test for route that isn't documented
Browse files Browse the repository at this point in the history
  • Loading branch information
spencewenski committed May 12, 2024
1 parent 35a45fb commit fe46519
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/service/http/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ impl HttpService {

#[cfg(test)]
mod tests {
use aide::axum::routing::get;

#[test]
#[cfg(feature = "open-api")]
Expand All @@ -152,6 +153,9 @@ mod tests {
.api_route("/a", delete_with(api_method, |op| op))
.api_route("/c", get_with(api_method, |op| op))
.api_route("/b", get_with(api_method, |op| op))
// Methods registered with `get` instead of `get_with` will not have OpenAPI
// documentation generated, but will still be included in the list of routes.
.api_route("/not_documented", get(api_method))
.finish_api(&mut open_api);

let service = HttpService {
Expand All @@ -166,7 +170,7 @@ mod tests {
.collect_vec();
assert_eq!(
paths,
["/a", "/b", "/bar", "/baz", "/c", "/foo"]
["/a", "/b", "/bar", "/baz", "/c", "/foo", "/not_documented"]
.iter()
.map(|s| s.to_string())
.collect_vec()
Expand Down

0 comments on commit fe46519

Please sign in to comment.