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

@@ -56,8 +56,6 @@ fn snapshot_chat_with_unread_count() {
#[test]
fn test_incoming_message_shows_unread_badge() {
use tele_tui::tdlib::ChatInfo;
use tele_tui::types::ChatId;
// Создаём чат БЕЗ непрочитанных сообщений
let chat = TestChatBuilder::new("Friend", 999)
@@ -97,7 +95,7 @@ fn test_incoming_message_shows_unread_badge() {
#[tokio::test]
async fn test_opening_chat_clears_unread_badge() {
use helpers::test_data::TestMessageBuilder;
use tele_tui::tdlib::TdClientTrait;
use tele_tui::types::{ChatId, MessageId};
// Создаём чат с 3 непрочитанными сообщениями
@@ -188,7 +186,7 @@ async fn test_opening_chat_clears_unread_badge() {
#[tokio::test]
async fn test_opening_chat_loads_many_messages() {
use helpers::test_data::TestMessageBuilder;
use tele_tui::tdlib::TdClientTrait;
use tele_tui::types::ChatId;
// Создаём чат с 50 сообщениями
@@ -205,7 +203,7 @@ async fn test_opening_chat_loads_many_messages() {
})
.collect();
let mut app = TestAppBuilder::new()
let app = TestAppBuilder::new()
.with_chat(chat)
.with_messages(888, messages)
.build();
@@ -230,7 +228,6 @@ async fn test_opening_chat_loads_many_messages() {
#[tokio::test]
async fn test_chat_history_chunked_loading() {
use tele_tui::tdlib::TdClientTrait;
use tele_tui::types::ChatId;
// Создаём чат с 120 сообщениями (больше чем TDLIB_MESSAGE_LIMIT = 50)
@@ -247,7 +244,7 @@ async fn test_chat_history_chunked_loading() {
})
.collect();
let mut app = TestAppBuilder::new()
let app = TestAppBuilder::new()
.with_chat(chat)
.with_messages(999, messages)
.build();
@@ -295,7 +292,6 @@ async fn test_chat_history_chunked_loading() {
#[tokio::test]
async fn test_chat_history_loads_all_without_limit() {
use tele_tui::tdlib::TdClientTrait;
use tele_tui::types::ChatId;
// Создаём чат с 200 сообщениями (4 чанка по 50)
@@ -311,7 +307,7 @@ async fn test_chat_history_loads_all_without_limit() {
})
.collect();
let mut app = TestAppBuilder::new()
let app = TestAppBuilder::new()
.with_chat(chat)
.with_messages(1001, messages)
.build();
@@ -331,8 +327,7 @@ async fn test_chat_history_loads_all_without_limit() {
#[tokio::test]
async fn test_load_older_messages_pagination() {
use tele_tui::tdlib::TdClientTrait;
use tele_tui::types::{ChatId, MessageId};
use tele_tui::types::ChatId;
// Создаём чат со 150 сообщениями
let chat = TestChatBuilder::new("Paginated Chat", 1002)
@@ -347,7 +342,7 @@ async fn test_load_older_messages_pagination() {
})
.collect();
let mut app = TestAppBuilder::new()
let app = TestAppBuilder::new()
.with_chat(chat)
.with_messages(1002, messages)
.build();
@@ -490,8 +485,6 @@ fn snapshot_chat_search_mode() {
#[test]
fn snapshot_chat_with_online_status() {
use tele_tui::tdlib::UserOnlineStatus;
use tele_tui::types::ChatId;
let chat = TestChatBuilder::new("Alice", 123)
.last_message("Hey there!")