tests
This commit is contained in:
@@ -159,3 +159,36 @@ fn snapshot_chat_search_mode() {
|
||||
let output = buffer_to_string(&buffer);
|
||||
assert_snapshot!("chat_list_search_mode", output);
|
||||
}
|
||||
|
||||
#[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!")
|
||||
.build();
|
||||
|
||||
let mut app = TestAppBuilder::new()
|
||||
.with_chat(chat)
|
||||
.selected_chat(123)
|
||||
.build();
|
||||
|
||||
// Устанавливаем онлайн-статус для чата напрямую
|
||||
let chat_id = ChatId::new(123);
|
||||
let user_id = tele_tui::types::UserId::new(123);
|
||||
|
||||
// Регистрируем чат как приватный
|
||||
app.td_client.user_cache.register_private_chat(chat_id, user_id);
|
||||
|
||||
// Устанавливаем онлайн-статус
|
||||
app.td_client.user_cache.user_statuses.insert(user_id, UserOnlineStatus::Online);
|
||||
|
||||
let buffer = render_to_buffer(80, 24, |f| {
|
||||
tele_tui::ui::chat_list::render(f, f.area(), &mut app);
|
||||
});
|
||||
|
||||
let output = buffer_to_string(&buffer);
|
||||
assert_snapshot!("chat_with_online_status", output);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user