()
| 504 | |
| 505 | #[test] |
| 506 | fn test_parse_defaults() { |
| 507 | let json = r#"{ |
| 508 | "steps": [ |
| 509 | {"type": "kg_search", "query": "test"}, |
| 510 | {"type": "kg_neighbors", "node_id": "intent:X"}, |
| 511 | {"type": "vector_search", "query": "test"}, |
| 512 | {"type": "read_content", "sources": ["a.md"]} |
| 513 | ] |
| 514 | }"#; |
| 515 | let plan = parse_plan(json).unwrap(); |
| 516 | assert_eq!(plan.steps.len(), 4); |
| 517 | match &plan.steps[0] { |
| 518 | QueryStep::KgSearch { limit, bind, .. } => { |
| 519 | assert_eq!(*limit, 10); |
| 520 | assert!(bind.is_none()); |
| 521 | } |
| 522 | _ => panic!("Expected KgSearch"), |
| 523 | } |
| 524 | match &plan.steps[1] { |
| 525 | QueryStep::KgNeighbors { depth, bind, .. } => { |
| 526 | assert_eq!(*depth, 1); |
| 527 | assert!(bind.is_none()); |
| 528 | } |
| 529 | _ => panic!("Expected KgNeighbors"), |
| 530 | } |
| 531 | match &plan.steps[2] { |
| 532 | QueryStep::VectorSearch { top_k, bind, .. } => { |
| 533 | assert_eq!(*top_k, 5); |
| 534 | assert!(bind.is_none()); |
| 535 | } |
| 536 | _ => panic!("Expected VectorSearch"), |
| 537 | } |
| 538 | match &plan.steps[3] { |
| 539 | QueryStep::ReadContent { |
| 540 | max_chars, bind, .. |
| 541 | } => { |
| 542 | assert_eq!(*max_chars, 2000); |
| 543 | assert!(bind.is_none()); |
| 544 | } |
| 545 | _ => panic!("Expected ReadContent"), |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | #[test] |
| 550 | fn test_parse_invalid_plan() { |
nothing calls this directly
no test coverage detected