Skip to content

test(tokens): supply accountController to SwapViewModel - #1345

Merged
bmc08gt merged 1 commit into
code/cashfrom
test/swap-viewmodel-account-controller
Aug 27, 2026
Merged

test(tokens): supply accountController to SwapViewModel#1345
bmc08gt merged 1 commit into
code/cashfrom
test/swap-viewmodel-account-controller

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

code/cash does not compile its :apps:flipcash:shared:tokens unit tests. #1341 added a required accountController parameter to SwapViewModel and changed only SwapViewModel.kt, leaving SwapViewModelErrorTest.createViewModel() on the old constructor:

SwapViewModelErrorTest.kt:122:13 No value passed for parameter 'accountController'.

Every branch cut from code/cash inherits the break, because PR CI builds the merge commit rather than the branch head. #1344 is where I hit it.

The fix is the mock and the argument. observeHasAccountFor is stubbed to return false: nothing in this file exercises the first-buy/top-up branch it feeds, and an explicit answer is steadier than a relaxed mock's empty flow.

SwapViewModelStateTest only uses the companion object, so it compiles either way and is untouched.

:apps:flipcash:shared:tokens:testDebugUnitTest runs 35 tests across both classes with no failures.

#1341 added a required `accountController` parameter to `SwapViewModel` and
changed only `SwapViewModel.kt`, so `SwapViewModelErrorTest.createViewModel()`
still calls the old constructor. The module's unit tests have not compiled
since it merged, which fails every PR built against `code/cash`.

Add the mock in constructor order and stub `observeHasAccountFor` to return
false. Nothing in this file exercises the first-buy/top-up branch it feeds, and
an explicit answer is steadier than a relaxed mock's empty flow.

`SwapViewModelStateTest` never constructs the view model, so it needs nothing.
@bmc08gt bmc08gt self-assigned this Aug 27, 2026
@github-actions github-actions Bot added type: test Test additions or improvements area: tokens Token accounts, balances, token info and removed type: test Test additions or improvements labels Aug 27, 2026
@bmc08gt
bmc08gt merged commit 54c8fee into code/cash Aug 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: tokens Token accounts, balances, token info

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant