Skip to content

test: dfx_widget_service + real_unit_account_service (+9 tests)#339

Merged
TaprootFreak merged 1 commit into
developfrom
test/widget-account-services
May 15, 2026
Merged

test: dfx_widget_service + real_unit_account_service (+9 tests)#339
TaprootFreak merged 1 commit into
developfrom
test/widget-account-services

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

Stage 15 of the coverage push. Two more DFX services.

Service Test file Cases
`lib/packages/service/dfx/dfx_widget_service.dart` `test/packages/service/dfx/dfx_widget_service_test.dart` 5
`lib/packages/service/dfx/real_unit_account_service.dart` `test/packages/service/dfx/real_unit_account_service_test.dart` 4

What each file covers

  • dfx_widget_service: `wallet` getter returns `appStore.wallet.currentAccount`; `walletAddress` returns the EIP-55 hex of the primary address (pinned to the Hardhat #0 address); `isAvailable` flips with the auth-token presence on the session cache.
  • real_unit_account_service: `getPortfolioHistory` GETs `/v1/realunit/account/` (path uses the wallet's primary address); parses `valueChf`/`valueEur` scaled by 100; treats null value as 0; returns `[]` on non-200 (does NOT throw — intentional).

Notes

  • `real_unit_account_service` uses `appStore.wallet.currentAccount.primaryAddress.address.hexEip55` to build the request path. The test plumbs a real `SoftwareWallet` (Hardhat #0 mnemonic) through the AppStore mock so the EIP-55 hex is real, not stubbed.

Test plan

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

Stage 15 of the coverage push.

- dfx_widget_service (5): wallet getter returns
  appStore.wallet.currentAccount; walletAddress is the EIP-55 hex
  of the primary address; isAvailable=false without auth token;
  isAvailable=true once token set; flips back after clearAuthToken
- real_unit_account_service (4): getPortfolioHistory GETs
  /v1/realunit/account/<eip55-hex> and parses CHF values scaled by
  100; EUR variant uses valueEur; null value treated as 0; returns
  [] on non-200 (does not throw)
@TaprootFreak TaprootFreak marked this pull request as ready for review May 15, 2026 11:47
@TaprootFreak TaprootFreak merged commit 700597f into develop May 15, 2026
1 check passed
@TaprootFreak TaprootFreak deleted the test/widget-account-services branch May 15, 2026 11:47
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