MCPcopy Create free account
hub / github.com/AI45Lab/Code / test_context_query_builder

Function test_context_query_builder

core/src/context/mod.rs:471–491  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

469
470 #[test]
471 fn test_context_query_builder() {
472 let query = ContextQuery::new("test")
473 .with_types([ContextType::Memory, ContextType::Skill])
474 .with_depth(ContextDepth::Full)
475 .with_max_results(5)
476 .with_max_tokens(2000)
477 .with_session_id("sess-123")
478 .with_param("custom", serde_json::json!("value"));
479
480 assert_eq!(query.context_types.len(), 2);
481 assert!(query.context_types.contains(&ContextType::Memory));
482 assert!(query.context_types.contains(&ContextType::Skill));
483 assert_eq!(query.depth, ContextDepth::Full);
484 assert_eq!(query.max_results, 5);
485 assert_eq!(query.max_tokens, 2000);
486 assert_eq!(query.session_id, Some("sess-123".to_string()));
487 assert_eq!(
488 query.params.get("custom"),
489 Some(&serde_json::json!("value"))
490 );
491 }
492
493 #[test]
494 fn test_context_query_serialization() {

Callers

nothing calls this directly

Calls 6

with_paramMethod · 0.80
with_max_resultsMethod · 0.80
with_depthMethod · 0.80
with_typesMethod · 0.80
with_session_idMethod · 0.45
with_max_tokensMethod · 0.45

Tested by

no test coverage detected