mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Merge pull request #1108 from syrtcevvi/master
Add tests to issue #1107
This commit is contained in:
commit
7df5610620
1 changed files with 99 additions and 0 deletions
|
@ -476,6 +476,105 @@ mod test {
|
|||
assert_eq!(expected, actual);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_1107() {
|
||||
let update = r#"{
|
||||
"message": {
|
||||
"chat": {
|
||||
"id": -1001293752024,
|
||||
"title": "CryptoInside Chat",
|
||||
"type": "supergroup",
|
||||
"username": "cryptoinside_talk"
|
||||
},
|
||||
"date": 1721592028,
|
||||
"from": {
|
||||
"first_name": "Wert",
|
||||
"id": 6962620676,
|
||||
"is_bot": false,
|
||||
"username": "WertCrypto"
|
||||
},
|
||||
"message_id": 134545,
|
||||
"story": {
|
||||
"chat": {
|
||||
"id": -1002149282975,
|
||||
"title": "TON Spin",
|
||||
"type": "channel",
|
||||
"username": "TONSpinChannel"
|
||||
},
|
||||
"id": 2
|
||||
}
|
||||
},
|
||||
"update_id": 439432599
|
||||
}"#;
|
||||
|
||||
let Update { kind, .. } = serde_json::from_str::<Update>(update).unwrap();
|
||||
match kind {
|
||||
UpdateKind::Message(_) => {}
|
||||
_ => panic!("Expected `Message`"),
|
||||
}
|
||||
|
||||
let update = r#"{
|
||||
"message": {
|
||||
"chat": {
|
||||
"id": -1001293752024,
|
||||
"title": "CryptoInside Chat",
|
||||
"type": "supergroup",
|
||||
"username": "cryptoinside_talk"
|
||||
},
|
||||
"date": 1721592580,
|
||||
"entities": [
|
||||
{
|
||||
"length": 7,
|
||||
"offset": 0,
|
||||
"type": "bot_command"
|
||||
}
|
||||
],
|
||||
"from": {
|
||||
"first_name": "the Cable Guy",
|
||||
"id": 5964236329,
|
||||
"is_bot": false,
|
||||
"language_code":"en",
|
||||
"username": "spacewhaleblues"
|
||||
},
|
||||
"message_id": 134546,
|
||||
"message_thread_id": 134545,
|
||||
"reply_to_message": {
|
||||
"chat": {
|
||||
"id": -1001293752024,
|
||||
"title": "CryptoInside Chat",
|
||||
"type": "supergroup",
|
||||
"username": "cryptoinside_talk"
|
||||
},
|
||||
"date": 1721592028,
|
||||
"from": {
|
||||
"first_name": "Wert",
|
||||
"id": 6962620676,
|
||||
"is_bot": false,
|
||||
"username": "WertCrypto"
|
||||
},
|
||||
"message_id": 134545,
|
||||
"story": {
|
||||
"chat": {
|
||||
"id": -1002149282975,
|
||||
"title": "TON Spin",
|
||||
"type": "channel",
|
||||
"username": "TONSpinChannel"
|
||||
},
|
||||
"id": 2
|
||||
}
|
||||
},
|
||||
"text": "/report"
|
||||
},
|
||||
"update_id": 439432600
|
||||
}"#;
|
||||
|
||||
let Update { kind, .. } = serde_json::from_str::<Update>(update).unwrap();
|
||||
match kind {
|
||||
UpdateKind::Message(_) => {}
|
||||
_ => panic!("Expected `Message`"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn de_private_chat_text_message() {
|
||||
let text = r#"
|
||||
|
|
Loading…
Reference in a new issue