Skip to content

add test coverage for fetchTokenList('default') bundled token path #438

@gabitoesmiapodo

Description

@gabitoesmiapodo

User story / Problem statement

Currently, fetchTokenList('default') -- the code path that returns the bundled @uniswap/default-token-list when PUBLIC_USE_DEFAULT_TOKENS is true (the default) -- has zero test coverage. The test suite in src/hooks/useTokenLists.test.ts mocks PUBLIC_USE_DEFAULT_TOKENS: false, so this branch is never exercised. This is a problem because the bundled list loads on every default page load, and a major version bump (v13 to v18 in #434) can silently change the data shape with no automated detection.

Expected outcome

fetchTokenList('default') is covered by at least one test confirming it returns a valid, non-empty TokenList matching the expected schema.

Acceptance criteria

  • fetchTokenList('default') is called in a test without mocking @uniswap/default-token-list away
  • The test asserts the result has a non-empty tokens array and that entries conform to tokenSchema
  • Existing tests remain unaffected

Technical notes

fetchTokenList('default') returns defaultTokens as TokenList directly from src/hooks/useTokenLists.ts (no network call, no async). The existing test file mocks both @/src/constants/tokenLists and PUBLIC_USE_DEFAULT_TOKENS: false -- the new test should bypass those or set PUBLIC_USE_DEFAULT_TOKENS: true and avoid mocking the token list module.

Use the superpowers:test-driven-development skill when implementing.

Discovered during code review of #434 / PR #437.

Additional context

Should be implemented after #434 is merged into develop.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions