Skip to content

Commit 99cf7ab

Browse files
committed
test(signed-doc): content type string
Signed-off-by: bkioshn <[email protected]>
1 parent e498f35 commit 99cf7ab

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

rust/signed_doc/src/metadata/content_type.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,24 @@ mod tests {
112112
assert!(ContentType::Json.validate(&cbor_bytes).is_err());
113113
assert!(ContentType::Cbor.validate(&cbor_bytes).is_ok());
114114
}
115+
116+
#[test]
117+
fn content_type_string_test() {
118+
assert_eq!(
119+
ContentType::from_str("application/cbor").unwrap(),
120+
ContentType::Cbor
121+
);
122+
assert_eq!(
123+
ContentType::from_str("application/json").unwrap(),
124+
ContentType::Json
125+
);
126+
assert_eq!(
127+
"application/cbor".parse::<ContentType>().unwrap(),
128+
ContentType::Cbor
129+
);
130+
assert_eq!(
131+
"application/json".parse::<ContentType>().unwrap(),
132+
ContentType::Json
133+
);
134+
}
115135
}

0 commit comments

Comments
 (0)