You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
portfolioService has no tests: holdings and gas-balance mapping are uncovered
Labels / Complexity: testing · Medium Complexity — Medium
Problem
src/lib/portfolioService.ts returns token holdings and gas balances — currently from MOCK_TOKEN_HOLDINGS/MOCK_GAS_BALANCES (#20). It has no tests. The service's shape is the contract the portfolio store and dashboard consume, and it is completely unpinned before the mock is replaced.
Why this is architecturally hard
Mapping is the test design. The service maps raw balance data into the UI shapes; tests must pin the mapping so the mock-to-real migration (issue14 #20) cannot change what the dashboard receives.
Fallback behavior matters. The current fallback (MOCK_TOKEN_HOLDINGS[chainId] || []) needs a pinned replacement contract for unknown chains.
Acceptance criteria
Tests cover the mapping for known/unknown chains and the empty state.
portfolioService has no tests: holdings and gas-balance mapping are uncovered
Labels / Complexity: testing · Medium Complexity — Medium
Problem
src/lib/portfolioService.tsreturns token holdings and gas balances — currently fromMOCK_TOKEN_HOLDINGS/MOCK_GAS_BALANCES(#20). It has no tests. The service's shape is the contract the portfolio store and dashboard consume, and it is completely unpinned before the mock is replaced.Why this is architecturally hard
MOCK_TOKEN_HOLDINGS[chainId] || []) needs a pinned replacement contract for unknown chains.Acceptance criteria
npm test.Out of scope
The portfolio mock migration (#20); the store.
Getting started
src/lib/portfolioService.ts— the servicesrc/lib/__tests__/— existing lib test patternsCommands:
npm test.Good first files to read:
src/lib/portfolioService.ts.