MCPcopy Create free account
hub / github.com/ceramicnetwork/rust-ceramic / parse_test_data

Function parse_test_data

validation/src/test.rs:67–75  ·  view source on GitHub ↗
(data: &[u8])

Source from the content-addressed store, hash-verified

65}
66
67fn parse_test_data(data: &[u8]) -> ParsedSampleData {
68 let car = CarReader::new(data).unwrap();
69 let header = car.header().to_owned();
70 let blocks: HashMap<Cid, Vec<u8>> = car.into_iter().collect::<Result<_, _>>().unwrap();
71 assert_eq!(1, header.roots().len(), "More than one root not supported");
72 let root_cid = &header.roots()[0];
73 let meta = serde_ipld_dagcbor::from_slice::<TestMeta>(blocks.get(root_cid).unwrap()).unwrap();
74 ParsedSampleData { meta, blocks }
75}
76
77fn extract_controller(event: &unvalidated::Event<Ipld>) -> String {
78 match event {

Callers 1

get_test_eventFunction · 0.85

Calls 6

newFunction · 0.85
unwrapMethod · 0.80
into_iterMethod · 0.80
rootsMethod · 0.80
headerMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected