MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / project_omits_absent_optional_keys

Function project_omits_absent_optional_keys

atomic-canonical/src/prov.rs:321–340  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

319
320 #[test]
321 fn project_omits_absent_optional_keys() {
322 let mut input = sample_input("did:atomic:PERSON");
323 input.turn_parent = None;
324 input.agent_vendor = None;
325 input.started_at = None;
326 input.ended_at = None;
327 input.used = Vec::new();
328
329 let value = project(&input);
330 let activity = node_of_type(&value, "prov:Activity");
331 // Omitted, not null.
332 assert!(activity.get("turnParent").is_none());
333 assert!(activity.get("prov:startedAtTime").is_none());
334 assert!(activity.get("prov:endedAtTime").is_none());
335 // `used` is omitted when empty (unknown links omitted, never invented).
336 assert!(activity.get("used").is_none());
337
338 let agent = node_of_type(&value, "prov:SoftwareAgent");
339 assert!(agent.get("vendor").is_none());
340 }
341
342 #[test]
343 fn project_is_deterministic_over_signing_bytes() {

Callers

nothing calls this directly

Calls 3

sample_inputFunction · 0.85
projectFunction · 0.85
node_of_typeFunction · 0.85

Tested by

no test coverage detected