test: settings_user_data_cubit + transaction_history_service (+12 tests)#336
Merged
Merged
Conversation
Stage 12 of the coverage push.
- settings_user_data_cubit (6): Success when userData is present
with nationality+addressCountry country lookups; Success
surfaces pending change steps (filters non-{name/address/phone}
change steps and non-inReview status); userData=null + getUser
returns mail → Success(email); userData=null + getUser throws →
Success() with no email; Failure when getWalletStatus throws;
Failure when getCountryBySymbol throws
- transaction_history_service (6): fetchPendingTransactions returns []
without hitting the network when no auth token; GET shape with
Bearer JWT; returns [] on non-200 (does not throw); filters out
completed/failed/returned (isPending=false); filters out
transactions that do not belong to the current wallet; wallet
match is case-insensitive
3 tasks
TaprootFreak
added a commit
that referenced
this pull request
May 15, 2026
) ## Summary Stage 19 of the coverage push. Closes the previously-deferred apiBasedSync gap on TransactionHistoryService — kept in a separate file from \`fetchPendingTransactions\` (#336) to keep the repository mocks focused on the sync flow. | Method under test | Test file | Cases | | --- | --- | --- | | \`TransactionHistoryService.apiBasedSync\` | \`test/packages/service/transaction_history_service_sync_test.dart\` | 8 | ## What it covers - Non-200 on \`/v1/realunit/account/<addr>/history\` short-circuits: no repository writes (the cubit's early return when AccountHistoryDto is null). - Entries whose \`transfer\` field is null are skipped. - Inserts a plain \`Transaction\` when there is no matching DFX row. - Inserts a DFX-enriched transaction (\`insertDfxTransaction\`) when \`/v1/transaction\` has a row whose \`id\` is not null and whose \`inputTxId\` matches the history hash. - Existing transactions go through \`updateTransaction\` / \`updateDfxTransaction\` instead of insert (governed by \`existsTransaction\`). - The DFX-row match also accepts \`outputTxId\` — both directions are pinned. - DFX rows whose \`id\` is null fall back to the plain-Transaction insert path. ## Notes - Both endpoints are fetched via \`Future.wait\`. Reading \`request.url.path\` lets a single MockClient handler return different bodies for the two paths. - The test stubs \`existsTransaction\` to return false by default, then flips it to true for the update-path tests. ## Test plan - [x] \`flutter analyze\` on the new file — clean - [x] \`flutter test\` — 8 / 8 passing locally - [ ] CI green
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stage 12 of the coverage push. Covers the previously-deferred `settings_user_data_cubit` (3-service coordination + Country lookups) and the read-side of `transaction_history_service`.
What each file covers
Notes
Excluded (and why)
Test plan