MCPcopy Create free account
hub / github.com/dfinity/orbit / valid_model_conversion

Function valid_model_conversion

core/control-panel/impl/src/mappers/artifact.rs:22–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21 #[test]
22 fn valid_model_conversion() {
23 let model = Artifact::new(b"hello world".to_vec());
24 let dto = control_panel_api::ArtifactDTO::from(model.clone());
25
26 assert_eq!(dto.id, Uuid::from_bytes(*model.id()).to_string());
27 assert_eq!(dto.size, model.artifact().len() as u64);
28 assert_eq!(
29 dto.hash,
30 "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9".to_string()
31 );
32 assert_eq!(dto.artifact, model.artifact());
33 assert_eq!(dto.created_at, timestamp_to_rfc3339(&model.created_at()));
34 }
35}

Callers

nothing calls this directly

Calls 1

to_vecMethod · 0.80

Tested by

no test coverage detected