style: auto-format entire codebase with cargo fmt (stable rustfmt.toml)
Some checks failed
ci/woodpecker/pr/check Pipeline failed
CI / Check (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build (windows-latest) (pull_request) Has been cancelled

This commit is contained in:
Mikhail Kilin
2026-02-22 17:09:51 +03:00
parent 2442a90e23
commit 264f183510
90 changed files with 1632 additions and 1450 deletions

View File

@@ -12,10 +12,16 @@ async fn test_add_reaction_to_message() {
let client = FakeTdClient::new();
// Отправляем сообщение
let msg = client.send_message(ChatId::new(123), "React to this!".to_string(), None, None).await.unwrap();
let msg = client
.send_message(ChatId::new(123), "React to this!".to_string(), None, None)
.await
.unwrap();
// Добавляем реакцию
client.toggle_reaction(ChatId::new(123), msg.id(), "👍".to_string()).await.unwrap();
client
.toggle_reaction(ChatId::new(123), msg.id(), "👍".to_string())
.await
.unwrap();
// Проверяем что реакция записалась
let messages = client.get_messages(123);
@@ -46,7 +52,10 @@ async fn test_toggle_reaction_removes_it() {
let msg_id = messages_before[0].id();
// Toggle - удаляем свою реакцию
client.toggle_reaction(ChatId::new(123), msg_id, "👍".to_string()).await.unwrap();
client
.toggle_reaction(ChatId::new(123), msg_id, "👍".to_string())
.await
.unwrap();
let messages_after = client.get_messages(123);
assert_eq!(messages_after[0].reactions().len(), 0);
@@ -57,13 +66,28 @@ async fn test_toggle_reaction_removes_it() {
async fn test_multiple_reactions_on_one_message() {
let client = FakeTdClient::new();
let msg = client.send_message(ChatId::new(123), "Many reactions".to_string(), None, None).await.unwrap();
let msg = client
.send_message(ChatId::new(123), "Many reactions".to_string(), None, None)
.await
.unwrap();
// Добавляем несколько разных реакций
client.toggle_reaction(ChatId::new(123), msg.id(), "👍".to_string()).await.unwrap();
client.toggle_reaction(ChatId::new(123), msg.id(), "❤️".to_string()).await.unwrap();
client.toggle_reaction(ChatId::new(123), msg.id(), "😂".to_string()).await.unwrap();
client.toggle_reaction(ChatId::new(123), msg.id(), "🔥".to_string()).await.unwrap();
client
.toggle_reaction(ChatId::new(123), msg.id(), "👍".to_string())
.await
.unwrap();
client
.toggle_reaction(ChatId::new(123), msg.id(), "❤️".to_string())
.await
.unwrap();
client
.toggle_reaction(ChatId::new(123), msg.id(), "😂".to_string())
.await
.unwrap();
client
.toggle_reaction(ChatId::new(123), msg.id(), "🔥".to_string())
.await
.unwrap();
// Проверяем что все 4 реакции записались
let messages = client.get_messages(123);
@@ -151,7 +175,10 @@ async fn test_reaction_counter_increases() {
let msg_id = messages_before[0].id();
// Мы добавляем свою реакцию - счётчик должен увеличиться
client.toggle_reaction(ChatId::new(123), msg_id, "👍".to_string()).await.unwrap();
client
.toggle_reaction(ChatId::new(123), msg_id, "👍".to_string())
.await
.unwrap();
let messages = client.get_messages(123);
assert_eq!(messages[0].reactions()[0].count, 2);
@@ -177,7 +204,10 @@ async fn test_update_reaction_we_add_ours() {
let msg_id = messages_before[0].id();
// Добавляем нашу реакцию
client.toggle_reaction(ChatId::new(123), msg_id, "🔥".to_string()).await.unwrap();
client
.toggle_reaction(ChatId::new(123), msg_id, "🔥".to_string())
.await
.unwrap();
let messages = client.get_messages(123);
let reaction = &messages[0].reactions()[0];