Skip to content

Add unit tests for the search bar debounce hook returning the debounced value only after the configured delay #743

Description

@Chucks1093

Summary

The search bar uses a debounce hook to avoid firing a query on every keystroke. Unit tests should confirm the hook returns the raw value immediately after each keystroke, the debounced value only after the delay has elapsed, and that rapid input resets the timer.

Scope

  • Test that the debounced value is not updated immediately after input changes
  • Test that the debounced value updates to the latest input after the delay elapses
  • Test that rapid input (faster than the delay) only produces one debounced output
  • Test a delay of 0ms returns the debounced value immediately
  • Assert the timer is cleared on unmount (no state update after unmount)

Acceptance Criteria

  • Debounced value not updated immediately after input
  • Debounced value updates after the configured delay
  • Rapid input produces only one debounced output
  • 0ms delay returns value immediately
  • Timer cleared on unmount with no post-unmount state update

ETA: 12 hours


Coordinate on Telegram

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions