Wave 6: Integration tests, golden tests, index invariant tests, diff command (bd-rex, bd-2gp, bd-1ck)
This commit is contained in:
@@ -8,6 +8,7 @@ use tabled::Tabled;
|
||||
|
||||
use crate::core::cache::CacheManager;
|
||||
use crate::core::config::cache_dir;
|
||||
use crate::core::indexer::method_rank;
|
||||
use crate::errors::SwaggerCliError;
|
||||
use crate::output::robot;
|
||||
use crate::output::table::render_table_or_empty;
|
||||
@@ -88,23 +89,6 @@ struct EndpointRow {
|
||||
summary: String,
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Helpers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Map an HTTP method string to a sort rank.
|
||||
/// GET=0, POST=1, PUT=2, PATCH=3, DELETE=4, everything else=5.
|
||||
fn method_rank(method: &str) -> u8 {
|
||||
match method.to_uppercase().as_str() {
|
||||
"GET" => 0,
|
||||
"POST" => 1,
|
||||
"PUT" => 2,
|
||||
"PATCH" => 3,
|
||||
"DELETE" => 4,
|
||||
_ => 5,
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Execute
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -602,7 +586,9 @@ mod tests {
|
||||
assert_eq!(method_rank("PATCH"), 3);
|
||||
assert_eq!(method_rank("DELETE"), 4);
|
||||
assert_eq!(method_rank("OPTIONS"), 5);
|
||||
assert_eq!(method_rank("HEAD"), 5);
|
||||
assert_eq!(method_rank("HEAD"), 6);
|
||||
assert_eq!(method_rank("TRACE"), 7);
|
||||
assert_eq!(method_rank("FOOBAR"), 99);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user