diff --git a/src/protocol/helpers.rs b/src/protocol/helpers.rs index 6174f80..99ae7b2 100644 --- a/src/protocol/helpers.rs +++ b/src/protocol/helpers.rs @@ -115,3 +115,22 @@ where let inner = T::deserialize(value).unwrap_or_default(); Ok(inner) } + +#[cfg(test)] +mod tests { + #[test] + fn deserialize_one_multiple_values() { + use crate::protocol::helpers::deserialize_one; + use url::Url; + #[derive(serde::Deserialize)] + struct Note { + #[serde(deserialize_with = "deserialize_one")] + _to: Url, + } + + let note = serde_json::from_str::( + r#"{"_to": ["https://example.com/u/alice", "https://example.com/u/bob"] }"#, + ); + assert!(note.is_err()); + } +}