Skip to content

✨ [Feature request]: Add Comprehensive Unit Test Coverage for Common Utilities and Hooks #1687

@Suvam-paul145

Description

@Suvam-paul145

Contributor Guidelines

  • I have read the guidelines and discussion

Is your feature request related to a problem? Please describe.

The entire codebase has only 2 unit test files (both in src/plays/savings-calculator/). Critical infrastructure like custom hooks, utility functions, service layers, and the search/filter system have zero test coverage. The testing framework (Jest + React Testing Library) is properly configured but barely utilized.

Describe the solution you'd like.

  • Write unit tests for all custom hooks using @testing-library/react-hooks
  • Write unit tests for utility functions (commonUtils.js, formatCount.ts, coverImageUtil.js)
  • Write tests for the search query parser (search-helper.jsParseQuery, QueryDBTranslator)
  • Write integration tests for service functions with mocked GraphQL responses
  • Establish a test coverage threshold (e.g., 60% for src/common/) in CI

Affected Files:

  • src/common/hooks/useFetch.js — no tests
  • src/common/hooks/useCacheResponse.ts — no tests
  • src/common/hooks/useContributors.js — no tests
  • src/common/hooks/useFeaturedPlays.js — no tests
  • src/common/hooks/useGitHub.js — no tests
  • src/common/hooks/useLikePlays.js — no tests
  • src/common/hooks/useLocalStorage.js — no tests
  • src/common/utils/commonUtils.js — no tests
  • src/common/utils/formatCount.ts — no tests
  • src/common/services/plays.js — no tests
  • src/common/search/search-helper.js — no tests

Describe alternatives you've considered.

No alternative required

Screenshot / Screenshare

No response

Additional context

No response

Record

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions