Skip to content

test: create_wallet/restore_wallet/debug_auth + 2 dashboard cubits (+21 tests)#331

Merged
TaprootFreak merged 1 commit into
developfrom
test/dashboard-and-misc-cubits
May 15, 2026
Merged

test: create_wallet/restore_wallet/debug_auth + 2 dashboard cubits (+21 tests)#331
TaprootFreak merged 1 commit into
developfrom
test/dashboard-and-misc-cubits

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

Stage 8 of the coverage push. Adds 21 unit tests across five previously-untested cubits.

Cubit under test Test file Cases
`create_wallet/bloc/create_wallet_cubit.dart` `test/screens/create_wallet/create_wallet_cubit_test.dart` 4
`restore_wallet/cubit/restore_wallet/restore_wallet_cubit.dart` `test/screens/restore_wallet/restore_wallet_cubit_test.dart` 3
`debug_auth/cubit/debug_auth_cubit.dart` `test/screens/debug_auth/debug_auth_cubit_test.dart` 7
`dashboard/bloc/balance_cubit.dart` `test/screens/dashboard/balance_cubit_test.dart` 4
`dashboard/bloc/pending_transactions_cubit.dart` `test/screens/dashboard/pending_transactions_cubit_test.dart` 3

What each file covers

  • create_wallet_cubit: initial hides the seed + has no wallet, `createWallet` stores the new `SoftwareWallet` (pinning the `'Obi-Wallet-Kenobi'` default name), `toggleShowSeed` flips and returns to hidden after two toggles, `toggleShowSeed` preserves the wallet field.
  • restore_wallet_cubit: initial state, `restoreWallet` canonicalises mixed whitespace (` x y ` → `x y`) before delegating to `WalletService.restoreWallet`, the interim `isLoading=true` state is observable.
  • debug_auth_cubit: seeds `address` + `savedSignature` from the service; empty-address fallback when service has none; `fetchSignMessage` success + error; `authenticate` success + uses-state-address + error.
  • balance_cubit: initial zero-balance state shape `(chain, contract, wallet, asset)`; subscribes to `BalanceRepository.watchBalance` on init; emits each pushed balance through the stream; `close()` cancels the subscription cleanly.
  • pending_transactions_cubit: initial empty list; emits fetched list on construction; falls back to empty list (not state-error) when the service throws.

Excluded (and why)

  • dashboard_bloc + transaction-history sub-cubits + portfolio/price chart cubits — pull in multiple services or larger event-driven flows; would dwarf this PR.
  • transaction_history_receipt_cubit / settings_tax_report_cubit — both use `getTemporaryDirectory()` + real `File` IO; needs path_provider platform-channel plumbing.
  • sell_, sell_bitbox_, hardware_connect_bitbox_* — Bitbox-coupled or DFX-sell-flow-coupled; held back to avoid review conflicts with fix: keep dashboard buy actions visible #321 area.
  • transaction_history_filter_cubit — already covered by test(screens): cover screen cubits/blocs (+37 tests) #327.

Test plan

  • `flutter analyze` on the five new files — clean
  • `flutter test` — 21 / 21 passing locally
  • CI green

…21 tests)

Stage 8 of the coverage push.

- create_wallet_cubit (4): initial hides the seed + no wallet,
  createWallet stores the SoftwareWallet (verifies 'Obi-Wallet-Kenobi'
  name), toggleShowSeed flips and returns to hidden after two
  toggles, toggleShowSeed preserves wallet field
- restore_wallet_cubit (3): initial state, restoreWallet canonicalises
  whitespace before delegating to WalletService.restoreWallet, emits
  an interim isLoading=true state
- debug_auth_cubit (7): seeds address+savedSignature from service,
  empty-address fallback, fetchSignMessage success + error,
  authenticate success/uses-state-address/error
- balance_cubit (4): initial zero-balance state shape, subscribes to
  BalanceRepository.watchBalance on init, emits each pushed balance,
  close() cancels the subscription cleanly
- pending_transactions_cubit (3): initial empty list, emits fetched
  list on construction, falls back to empty list on service throw
@TaprootFreak TaprootFreak marked this pull request as ready for review May 15, 2026 09:01
@TaprootFreak TaprootFreak merged commit 4819757 into develop May 15, 2026
1 check passed
@TaprootFreak TaprootFreak deleted the test/dashboard-and-misc-cubits branch May 15, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant