Skip to content

test: wallet/pdf services + home_bloc onboarding flow (+17 tests)#335

Merged
TaprootFreak merged 1 commit into
developfrom
test/userdata-home-pdf-wallet
May 15, 2026
Merged

test: wallet/pdf services + home_bloc onboarding flow (+17 tests)#335
TaprootFreak merged 1 commit into
developfrom
test/userdata-home-pdf-wallet

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

Stage 11 of the coverage push.

File under test Test file Cases
`lib/packages/service/dfx/real_unit_wallet_service.dart` `test/packages/service/dfx/real_unit_wallet_service_test.dart` 3
`lib/packages/service/dfx/real_unit_pdf_service.dart` `test/packages/service/dfx/real_unit_pdf_service_test.dart` 9
`lib/screens/home/bloc/home_bloc.dart` `test/screens/home/home_bloc_test.dart` 5

What each file covers

  • real_unit_wallet_service: `getWalletStatus` GET shape with the Bearer JWT, parses both `isRegistered` branches when `userData` is null, throws ApiException on non-200.
  • real_unit_pdf_service: `getBalanceReport` POSTs the BalancePdfDto payload (`address`, currency code, uppercased language code); accepts 201; ApiException on non-2xx. `getTransactionsReceipt` (multi) posts `txHashes` + currency, defaults to CHF, ApiException on non-2xx. `getTransactionReceipt` (single) posts `txHash` + currency, defaults to CHF, ApiException on non-2xx.
  • home_bloc: initial `CheckWalletExistsEvent` for three branches: no wallet → `onboardingCompleted` forced false; wallet+terms accepted → `onboardingCompleted=true`; wallet without terms → `onboardingCompleted=false`. `CompleteOnboardingEvent` writes `termsAccepted=true` and emits. `AcceptSoftwareTermsEvent` writes `softwareTermsAccepted=true` and emits.

Notes

  • The PDF DTOs serialize `txId` as `txHash` on the wire (single) and `txIds` as `txHashes` (multi). The tests pin these names explicitly to lock the wire contract.
  • `Language` codes are uppercased in the balance-pdf payload (`Language.de` → `'DE'`). Also pinned.

Excluded (and why)

  • Other `home_bloc` handlers (`LoadCurrentWallet`, `DeleteCurrentWallet`, `LoadWallet`, `SyncWalletServices`, `DebugAuthComplete`) all touch `BalanceService.startSync` / `TransactionHistoryService.apiBasedSync` / `DfxWidgetService.getAuthToken` plus `AppStore.wallet` mutation. Each is meaningful but needs more dependency plumbing — deserves its own focused PR.
  • `settings_user_data_cubit` — still deferred (coordinates 3 services + Country lookups + multi-branch KYC step status); will land separately.

Test plan

  • `flutter analyze` on all three new files — clean
  • `flutter test` — 17 / 17 passing locally
  • CI green

…7 tests)

Stage 11 of the coverage push.

- real_unit_wallet_service (3): getWalletStatus GET shape with the
  Bearer JWT + parses both isRegistered branches; ApiException on
  non-200
- real_unit_pdf_service (9): getBalanceReport POSTs the BalancePdfDto
  payload (address + currency + uppercased language code); accepts
  201; ApiException on non-2xx; getTransactionsReceipt (multi) posts
  txHashes + currency, defaults to CHF, ApiException on non-2xx;
  getTransactionReceipt (single) posts txHash + currency, defaults
  to CHF, ApiException on non-2xx
- home_bloc (5): initial CheckWalletExistsEvent for three branches
  (no wallet → onboardingCompleted forced false; wallet+terms →
  onboardingCompleted true; wallet without terms → onboardingCompleted
  false); CompleteOnboardingEvent writes termsAccepted=true and emits;
  AcceptSoftwareTermsEvent writes softwareTermsAccepted=true and emits

The other home_bloc handlers (LoadCurrentWallet, DeleteCurrentWallet,
LoadWallet, SyncWalletServices, DebugAuthComplete) all touch
BalanceService.startSync / TransactionHistoryService.apiBasedSync /
DfxWidgetService.getAuthToken plus AppStore.wallet mutation, which
deserves a dedicated PR with proper integration of those dependencies.
@TaprootFreak TaprootFreak marked this pull request as ready for review May 15, 2026 11:46
@TaprootFreak TaprootFreak merged commit fe2ca23 into develop May 15, 2026
1 check passed
@TaprootFreak TaprootFreak deleted the test/userdata-home-pdf-wallet branch May 15, 2026 11:46
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