test(ai): Day 5.3 — 补充 5 个老 Tool 单元测试
- query_vitals: tool_name + schema_has_days_param - query_lab_reports: tool_name - query_appointments: tool_name - query_medications: tool_name - search_medical_knowledge: tool_name + schema_requires_query
This commit is contained in:
@@ -66,3 +66,14 @@ impl AgentTool for QueryAppointmentsTool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tool_name() {
|
||||||
|
let tool = QueryAppointmentsTool;
|
||||||
|
assert_eq!(tool.name(), "query_patient_appointments");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -83,3 +83,14 @@ impl AgentTool for QueryLabReportsTool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tool_name() {
|
||||||
|
let tool = QueryLabReportsTool;
|
||||||
|
assert_eq!(tool.name(), "query_patient_lab_reports");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -63,3 +63,14 @@ impl AgentTool for QueryMedicationsTool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tool_name() {
|
||||||
|
let tool = QueryMedicationsTool;
|
||||||
|
assert_eq!(tool.name(), "query_patient_medications");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -94,3 +94,21 @@ impl AgentTool for QueryPatientVitalsTool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tool_name() {
|
||||||
|
let tool = QueryPatientVitalsTool;
|
||||||
|
assert_eq!(tool.name(), "query_patient_vitals");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn schema_has_days_param() {
|
||||||
|
let tool = QueryPatientVitalsTool;
|
||||||
|
let schema = tool.parameters_schema();
|
||||||
|
assert!(schema["properties"]["days"].is_object());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -110,3 +110,26 @@ impl AgentTool for SearchMedicalKnowledgeTool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tool_name() {
|
||||||
|
let tool = SearchMedicalKnowledgeTool;
|
||||||
|
assert_eq!(tool.name(), "search_medical_knowledge");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn schema_requires_query() {
|
||||||
|
let tool = SearchMedicalKnowledgeTool;
|
||||||
|
let schema = tool.parameters_schema();
|
||||||
|
assert!(
|
||||||
|
schema["required"]
|
||||||
|
.as_array()
|
||||||
|
.unwrap()
|
||||||
|
.contains(&serde_json::json!("query"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user