ruma-events: Test the key agreement serialization/deserialization.

This commit is contained in:
Damir Jelić 2020-07-15 10:25:29 +02:00 committed by Jonas Platte
parent 02d7f8d17b
commit 9eb0266cb0
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67

View File

@ -66,3 +66,18 @@ pub enum VerificationMethod {
#[strum(serialize = "m.sas.v1")]
MSasV1,
}
#[cfg(test)]
mod test {
use super::KeyAgreementProtocol;
#[test]
fn serialize_key_agreement() {
let serialized =
serde_json::to_string(&KeyAgreementProtocol::Curve25519HkdfSha256).unwrap();
assert_eq!(serialized, "\"curve25519-hkdf-sha256\"");
let deserialized: KeyAgreementProtocol = serde_json::from_str(&serialized).unwrap();
assert_eq!(deserialized, KeyAgreementProtocol::Curve25519HkdfSha256);
}
}