Refactor TDLib facade and local time handling

This commit is contained in:
Mikhail Kilin
2026-05-17 17:58:29 +03:00
parent e09b83be69
commit 2e510dc932
38 changed files with 1025 additions and 862 deletions

View File

@@ -29,7 +29,7 @@ async fn test_add_reaction_to_message() {
assert_eq!(messages[0].reactions().len(), 1);
assert_eq!(messages[0].reactions()[0].emoji, "👍");
assert_eq!(messages[0].reactions()[0].count, 1);
assert_eq!(messages[0].reactions()[0].is_chosen, true);
assert!(messages[0].reactions()[0].is_chosen);
}
/// Test: Удаление реакции (toggle) - вторичное нажатие
@@ -47,7 +47,7 @@ async fn test_toggle_reaction_removes_it() {
// Проверяем что реакция есть
let messages_before = client.get_messages(123);
assert_eq!(messages_before[0].reactions().len(), 1);
assert_eq!(messages_before[0].reactions()[0].is_chosen, true);
assert!(messages_before[0].reactions()[0].is_chosen);
let msg_id = messages_before[0].id();
@@ -116,7 +116,7 @@ async fn test_reactions_from_multiple_users() {
assert_eq!(reaction.emoji, "👍");
assert_eq!(reaction.count, 3);
assert_eq!(reaction.is_chosen, false);
assert!(!reaction.is_chosen);
}
/// Test: Своя реакция (is_chosen = true)
@@ -134,7 +134,7 @@ async fn test_own_reaction_is_chosen() {
let messages = client.get_messages(123);
let reaction = &messages[0].reactions()[0];
assert_eq!(reaction.is_chosen, true);
assert!(reaction.is_chosen);
// В UI это будет отображаться в рамках: [❤️]
}
@@ -153,7 +153,7 @@ async fn test_other_reaction_not_chosen() {
let messages = client.get_messages(123);
let reaction = &messages[0].reactions()[0];
assert_eq!(reaction.is_chosen, false);
assert!(!reaction.is_chosen);
// В UI это будет отображаться без рамок: 😂 2
}
@@ -182,7 +182,7 @@ async fn test_reaction_counter_increases() {
let messages = client.get_messages(123);
assert_eq!(messages[0].reactions()[0].count, 2);
assert_eq!(messages[0].reactions()[0].is_chosen, true);
assert!(messages[0].reactions()[0].is_chosen);
}
/// Test: Обновление реакции - мы добавили свою к существующим
@@ -199,7 +199,7 @@ async fn test_update_reaction_we_add_ours() {
let messages_before = client.get_messages(123);
assert_eq!(messages_before[0].reactions()[0].count, 2);
assert_eq!(messages_before[0].reactions()[0].is_chosen, false);
assert!(!messages_before[0].reactions()[0].is_chosen);
let msg_id = messages_before[0].id();
@@ -213,7 +213,7 @@ async fn test_update_reaction_we_add_ours() {
let reaction = &messages[0].reactions()[0];
assert_eq!(reaction.count, 3);
assert_eq!(reaction.is_chosen, true);
assert!(reaction.is_chosen);
}
/// Test: Реакция с count=1 отображается только emoji
@@ -272,5 +272,5 @@ async fn test_reactions_on_multiple_messages() {
assert_eq!(messages[2].reactions().len(), 2);
assert_eq!(messages[2].reactions()[0].emoji, "😂");
assert_eq!(messages[2].reactions()[1].emoji, "🔥");
assert_eq!(messages[2].reactions()[1].is_chosen, true);
assert!(messages[2].reactions()[1].is_chosen);
}