feat(mcp): implement Prompts capability, Resources, and clean up daemon architecture
This commit is contained in:
1 parent
9b9b403ef2
commit
251757f8fc
29 files changed
+1276
-182
No files matched your search
@@ -37,3 +37,54 @@ impl IntoResponse for AppError {
|
||||
(status, body).into_response()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use axum::response::IntoResponse;
|
||||
use axum::http::StatusCode;
|
||||
|
||||
#[test]
|
||||
fn test_app_error_not_found() {
|
||||
let err = AppError::NotFound("item not found".into());
|
||||
let res = err.into_response();
|
||||
assert_eq!(res.status(), StatusCode::NOT_FOUND);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_app_error_forbidden() {
|
||||
let err = AppError::Forbidden("access denied".into());
|
||||
let res = err.into_response();
|
||||
assert_eq!(res.status(), StatusCode::FORBIDDEN);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_app_error_internal() {
|
||||
let err = AppError::Internal("db error".into());
|
||||
let res = err.into_response();
|
||||
assert_eq!(res.status(), StatusCode::INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_app_error_bad_request() {
|
||||
let err = AppError::BadRequest("invalid json".into());
|
||||
let res = err.into_response();
|
||||
assert_eq!(res.status(), StatusCode::BAD_REQUEST);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_app_error_display() {
|
||||
let err = AppError::NotFound("test".into());
|
||||
assert_eq!(err.to_string(), "Not Found: test");
|
||||
|
||||
let err = AppError::Forbidden("test".into());
|
||||
assert_eq!(err.to_string(), "Forbidden: test");
|
||||
|
||||
let err = AppError::Internal("test".into());
|
||||
assert_eq!(err.to_string(), "Internal Server Error: test");
|
||||
|
||||
let err = AppError::BadRequest("test".into());
|
||||
assert_eq!(err.to_string(), "Bad Request: test");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user