Skip to content

feat: add unit tests for applyListingControls, getRewardValue, and sort helpers (Closes #406) [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH] - #528

Open
waterWang wants to merge 1 commit into
BountyOnChain:mainfrom
waterWang:feat/unit-tests-406-clean
Open

feat: add unit tests for applyListingControls, getRewardValue, and sort helpers (Closes #406) [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH]#528
waterWang wants to merge 1 commit into
BountyOnChain:mainfrom
waterWang:feat/unit-tests-406-clean

Conversation

@waterWang

Copy link
Copy Markdown

What this adds

Unit tests for the standalone helper functions in app/page.tsx:

Functions tested

  • getRewardValue — handles string, number, null, undefined
  • getDeadlineValue — handles null → Infinity
  • normalizePage — defaults to 1 for invalid input
  • normalizeLimit — defaults to 20, caps at 100
  • normalizeSort — passes through valid options, defaults to 'newest'
  • normalizeStatus — passes through valid options, defaults to 'all'
  • applyListingControls — sorting by reward/deadline, status filtering, search filtering, combined filters

Coverage

  • 35 tests across 7 describe blocks
  • ≥ 95% line coverage on the targeted helpers

Files changed

  • app/page.spec.ts (new) — 287 lines
  • app/page.tsx — added export to 7 functions

Closes #406

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.

[S-B] Add unit tests for applyListingControls and getRewardValue sort helpers

1 participant