Skip to content

test(tron-wallet-snap): slim AssetsService tests to façade delegation - #162

Closed
ulissesferreira wants to merge 2 commits into
WPN-1497-route-assets-logic-based-on-feature-flagfrom
ulissesferreira/assets-service-facade-tests-537b
Closed

test(tron-wallet-snap): slim AssetsService tests to façade delegation#162
ulissesferreira wants to merge 2 commits into
WPN-1497-route-assets-logic-based-on-feature-flagfrom
ulissesferreira/assets-service-facade-tests-537b

Conversation

@ulissesferreira

@ulissesferreira ulissesferreira commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Explanation

AssetsService is a routing façade over SnapAssetsAdapter and CoreAssetsAdapter. Its tests still constructed real adapters and re-tested Snap fetch/save behavior (bandwidth, energy, staking, persistence) plus Core mapping/publish behavior.

This PR:

  • Moves the Snap-path coverage from AssetsService.test.ts into SnapAssetsAdapter.test.ts
  • Rewrites AssetsService tests to mock both adapters and assert only routing: Snap vs Core based on the Tron migration flag, plus the methods that always stay on Snap
  • Leaves Core adapter behavior in CoreAssetsAdapter.test.ts

Stacked on #145. Test-only; no changelog or breaking changes.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Test plan

  • yarn workspace @metamask/tron-wallet-snap exec jest --no-coverage src/services/assets/AssetsService.test.ts src/services/assets/adapters/SnapAssetsAdapter.test.ts src/services/assets/adapters/CoreAssetsAdapter.test.ts — 85 passed
  • yarn workspace @metamask/tron-wallet-snap run test — coverage thresholds met; AssetsService.ts is 100% statements/branches/functions/lines
Open in Web Open in Cursor 

cursoragent and others added 2 commits August 18, 2026 10:30
Move Snap-path behavior coverage into SnapAssetsAdapter tests and keep
AssetsService tests focused on adapter routing based on the migration flag.

Co-authored-by: Ulisses Ferreira <ulisses@hey.com>
Use expect(await ...) instead of .resolves, and drop the unused
no-explicit-any suppression from the old service test file.

Co-authored-by: Ulisses Ferreira <ulisses@hey.com>
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.

2 participants