()
| 596 | |
| 597 | #[test] |
| 598 | fn test_parse_defaults() { |
| 599 | let json = r#"{ |
| 600 | "schema_version": 1, |
| 601 | "steps": [ |
| 602 | {"type": "kg_search", "query": "test"}, |
| 603 | {"type": "kg_neighbors", "node_id": "intent:X"}, |
| 604 | {"type": "vector_search", "query": "test"}, |
| 605 | {"type": "read_content", "sources": ["a.md"]} |
| 606 | ] |
| 607 | }"#; |
| 608 | let plan = parse_plan(json).unwrap(); |
| 609 | assert_eq!(plan.steps.len(), 4); |
| 610 | match &plan.steps[0] { |
| 611 | QueryStep::KgSearch { limit, bind, .. } => { |
| 612 | assert_eq!(*limit, 10); |
| 613 | assert!(bind.is_none()); |
| 614 | } |
| 615 | _ => panic!("Expected KgSearch"), |
| 616 | } |
| 617 | match &plan.steps[1] { |
| 618 | QueryStep::KgNeighbors { depth, bind, .. } => { |
| 619 | assert_eq!(*depth, 1); |
| 620 | assert!(bind.is_none()); |
| 621 | } |
| 622 | _ => panic!("Expected KgNeighbors"), |
| 623 | } |
| 624 | match &plan.steps[2] { |
| 625 | QueryStep::VectorSearch { top_k, bind, .. } => { |
| 626 | assert_eq!(*top_k, 5); |
| 627 | assert!(bind.is_none()); |
| 628 | } |
| 629 | _ => panic!("Expected VectorSearch"), |
| 630 | } |
| 631 | match &plan.steps[3] { |
| 632 | QueryStep::ReadContent { |
| 633 | max_chars, bind, .. |
| 634 | } => { |
| 635 | assert_eq!(*max_chars, 2000); |
| 636 | assert!(bind.is_none()); |
| 637 | } |
| 638 | _ => panic!("Expected ReadContent"), |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | #[test] |
| 643 | fn test_parse_invalid_plan() { |
nothing calls this directly
no test coverage detected