MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / test_to_json_line_format

Function test_to_json_line_format

crates/openshell-ocsf/src/format/jsonl.rs:70–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68
69 #[test]
70 fn test_to_json_line_format() {
71 let event = test_event();
72 let line = event.to_json_line().unwrap();
73
74 // Must be a single line ending with \n
75 assert!(line.ends_with('\n'));
76 assert_eq!(line.matches('\n').count(), 1);
77
78 // Must parse back to the same JSON
79 let parsed: serde_json::Value = serde_json::from_str(line.trim()).unwrap();
80 assert_eq!(parsed, event.to_json().unwrap());
81 }
82
83 #[test]
84 fn test_optional_fields_omitted() {

Callers

nothing calls this directly

Calls 2

to_json_lineMethod · 0.80
test_eventFunction · 0.70

Tested by

no test coverage detected