fix: add photo_download_rx channel and fix account switcher nav tests
Some checks 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

Add UnboundedReceiver for background photo downloads to App state,
reset it on close_chat. Fix account_switcher tests to navigate past
all accounts dynamically instead of assuming single account.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Mikhail Kilin
2026-02-22 16:19:04 +03:00
parent 78fe09bf11
commit df19bc742c
3 changed files with 31 additions and 6 deletions

View File

@@ -47,8 +47,15 @@ fn test_account_switcher_navigate_down() {
let mut app = TestAppBuilder::new().build();
app.open_account_switcher();
// Initially at 0, navigate down to "Add account" item
app.account_switcher_select_next();
let num_accounts = match &app.account_switcher {
Some(AccountSwitcherState::SelectAccount { accounts, .. }) => accounts.len(),
_ => panic!("Expected SelectAccount state"),
};
// Navigate down past all accounts to "Add account" item
for _ in 0..num_accounts {
app.account_switcher_select_next();
}
match &app.account_switcher {
Some(AccountSwitcherState::SelectAccount {
@@ -56,7 +63,7 @@ fn test_account_switcher_navigate_down() {
accounts,
..
}) => {
// Should be at index 1 (the "Add account" item, since default config has 1 account)
// Should be at the "Add account" item (index == accounts.len())
assert_eq!(*selected_index, accounts.len());
}
_ => panic!("Expected SelectAccount state"),
@@ -116,8 +123,15 @@ fn test_confirm_add_account_transitions_to_add_state() {
let mut app = TestAppBuilder::new().build();
app.open_account_switcher();
// Navigate to "+ Add account"
app.account_switcher_select_next();
let num_accounts = match &app.account_switcher {
Some(AccountSwitcherState::SelectAccount { accounts, .. }) => accounts.len(),
_ => panic!("Expected SelectAccount state"),
};
// Navigate past all accounts to "+ Add account"
for _ in 0..num_accounts {
app.account_switcher_select_next();
}
// Confirm should transition to AddAccount
app.account_switcher_confirm();