descriptor deserializing test (serde(default) are omited) added
@@ -7,7 +7,8 @@ use url::Url;
#[test]
fn deserialize_descriptor() {
- let descriptor = Descriptor {
+ let descriptors = vec![
+ Descriptor {
manifest: Manifest {
id: "id".to_owned(),
version: Version::new(0, 0, 1),
@@ -62,8 +63,33 @@ fn deserialize_descriptor() {
.cloned()
.collect(),
},
- };
- let descriptor_json = r#"
+ },
+ Descriptor {
+ manifest: Manifest {
+ id: "id".to_owned(),
+ version: Version::new(0, 0, 1),
+ name: "name".to_owned(),
+ contact_email: None,
+ description: None,
+ logo: None,
+ background: None,
+ types: vec![],
+ resources: vec![],
+ id_prefixes: None,
+ catalogs: vec![],
+ addon_catalogs: vec![],
+ behavior_hints: vec![].iter().cloned().collect(),
+ },
+ transport_url: Url::parse("https://transport_url").unwrap(),
+ flags: DescriptorFlags {
+ official: false,
+ protected: false,
+ extra: vec![].iter().cloned().collect(),
+ },
+ },
+ ];
+ let descriptors_json = r#"
+ [
{
"manifest": {
"id": "id",
@@ -131,11 +157,23 @@ fn deserialize_descriptor() {
"protected": true,
"flag": true
}
+ },
+ {
+ "manifest": {
+ "id": "id",
+ "version": "0.0.1",
+ "name": "name",
+ "types": [],
+ "resources": [],
+ "idPrefixes": null
+ },
+ "transportUrl": "https://transport_url/"
}
+ ]
"#;
- let descriptor_deserialize: Descriptor = serde_json::from_str(&descriptor_json).unwrap();
+ let descriptors_deserialize: Vec<Descriptor> = serde_json::from_str(&descriptors_json).unwrap();
assert_eq!(
- descriptor, descriptor_deserialize,
+ descriptors, descriptors_deserialize,
"descriptor deserialized successfully"
);
}
