Skip to content

Add infinite-scroll test for src/features/dashboard/pages/DiscoverPage.tsx #507

Description

@Jagadeeshftw

📌 Description

src/features/dashboard/pages/DiscoverPage.tsx (has a test file already) may use infinite scroll or 'load more' for its feed. Without a dedicated test, a regression could cause duplicate items to load, the loader to spin forever past the last page, or a scroll-position jump when new items are appended.

🧩 Requirements and context

  • Add a test that scrolling near the bottom (or clicking 'load more') fetches and appends the next page without duplicating existing items.
  • Add a test for the end-of-results state (loader stops, a clear 'no more results' indicator shown).
  • Add a test that scroll position doesn't jump unexpectedly when new items are appended.

Non-functional requirements

  • Must be secure, tested, and documented.
  • Should be efficient and easy to review.

🛠️ Suggested execution

1. Fork the repo and create a branch

git checkout -b test/discover-page-infinite-scroll

2. Implement changes

  • Modify: src/features/dashboard/pages/DiscoverPage.test.tsx — add the infinite-scroll/load-more cases.

3. Test and commit

  • Run tests:
npm test -- run DiscoverPage
  • Cover edge cases: rapid repeated triggers near the bottom (should not fire duplicate fetches), last page reached, fetch failure mid-scroll (should allow retry, not silently stop).
  • Include test output and details in the PR description.

Example commit message

test: add infinite-scroll and end-of-results coverage for DiscoverPage

✅ Acceptance criteria

  • Repeated near-bottom triggers do not cause duplicate page fetches or duplicated rendered items.
  • End-of-results state is clearly shown and the loader stops.
  • A mid-scroll fetch failure is recoverable via retry, not a silent dead end.

🔒 Security notes

None beyond standard regression risk; duplicate fetch triggers are a minor unnecessary-load concern on the backend.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issuefrontendFrontend / UI worktestingTests and coverage

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions