Skip to content

test: add unit tests for accessibility, search UI, and utility functi… - #1311

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
PeterOche:feat/shared-debounce-utility
Aug 31, 2026
Merged

test: add unit tests for accessibility, search UI, and utility functi…#1311
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
PeterOche:feat/shared-debounce-utility

Conversation

@PeterOche

Copy link
Copy Markdown

Description

This PR resolves several open issues addressing search UI empty states, utility unit test coverage, and hook debounce reuse:

  • Search Empty State (Show an empty-state on the search page when there are no results #1295):

    • Rendered an accessible empty-state message and actionable filter/query suggestions in SearchResultsVisualizer when search returns 0 matches.
    • Added accessibility attributes (role="status", aria-live="polite", data-testid="search-empty-state", aria-hidden="true" on the icon).
    • Wrapped AdvancedSearchInterface in a Next.js Suspense boundary in src/app/search/page.tsx.
    • Added unit test suite in SearchResultsVisualizer.test.tsx.
  • Accessibility Utilities Unit Tests (Add unit tests for the accessibility utilities #1296):

    • Added unit test suite in src/utils/tests/accessibilityUtils.test.ts covering contrast calculations, focusability, roving focus candidates, focus trapping, accessible names, screen reader announcements, and WCAG audit checks.
    • Added 3-digit shorthand hex code support in hexToRgb.
  • Notification Utilities Unit Tests (Add unit tests for the notification utilities #1297):

    • Added comprehensive unit test suite in src/utils/tests/notificationUtils.test.ts covering timestamp formatting, quiet hours calculations, delivery decisions, analytics aggregation, sorting, filtering, date grouping, preference validation, and default preference generation.
    • Added defensive guards against invalid timestamp formats and malformed preferences.
  • Shared Debounce in Search Filters Hook (Reuse the shared debounce utility in the search-filters hook #1293):

    • Added cancellation support (.cancel()) to debounce in src/utils/formUtils.ts.
    • Refactored useSearchFilters.tsx to replace inline setTimeout/clearTimeout timers with the shared debounce utility.
    • Added unit tests for debounce and throttle in src/utils/tests/formUtils.test.ts.

Related Issues


Files Changed

  • src/app/search/page.tsx
  • src/components/search/SearchResultsVisualizer.tsx
  • src/components/search/__tests__/SearchResultsVisualizer.test.tsx
  • src/utils/accessibilityUtils.ts
  • src/utils/tests/accessibilityUtils.test.ts
  • src/utils/notificationUtils.ts
  • src/utils/tests/notificationUtils.test.ts
  • src/utils/formUtils.ts
  • src/hooks/useSearchFilters.tsx
  • src/utils/tests/formUtils.test.ts

Checklist

  • Implemented across all target files
  • Unit/integration tests added and covering happy paths and edge cases
  • No regressions; follows project coding conventions

…ons while refactoring search filter debouncing.
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@PeterOche Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER
RUKAYAT-CODER merged commit adda6bd into rinafcode:main Aug 31, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants