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

Function test_context_item_serialization

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

Source from the content-addressed store, hash-verified

594
595 #[test]
596 fn test_context_item_serialization() {
597 let item = ContextItem::new("item-3", ContextType::Skill, "Skill instructions")
598 .with_token_count(200)
599 .with_relevance(0.9)
600 .with_source("viking://skills/code-review");
601
602 let json = serde_json::to_string(&item).unwrap();
603 let parsed: ContextItem = serde_json::from_str(&json).unwrap();
604
605 assert_eq!(parsed.id, "item-3");
606 assert_eq!(parsed.context_type, ContextType::Skill);
607 assert_eq!(parsed.content, "Skill instructions");
608 assert_eq!(parsed.token_count, 200);
609 }
610
611 // ========================================================================
612 // ContextResult Tests

Callers

nothing calls this directly

Calls 3

with_sourceMethod · 0.80
with_relevanceMethod · 0.80
with_token_countMethod · 0.80

Tested by

no test coverage detected