Add serialization tests for ChatId

This commit is contained in:
Waffle 2019-09-05 19:00:26 +03:00
parent e58d40a765
commit 4094c1ceb8

View file

@ -64,6 +64,27 @@ pub enum ChatId {
ChannelUsername(String),
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn chat_id_id_serialization() {
let expected_json = String::from(r#"123456"#);
let actual_json = serde_json::to_string(&ChatId::Id(123456)).unwrap();
assert_eq!(expected_json, actual_json)
}
#[test]
fn chat_id_channel_username_serialization() {
let expected_json = String::from(r#""@username""#);
let actual_json = serde_json::to_string(&ChatId::ChannelUsername(String::from("@username"))).unwrap();
assert_eq!(expected_json, actual_json)
}
}
pub mod get_me;
pub mod send_message;
pub mod forward_message;