Skip to content

test: test files for src/hooks (use-mobile, use-toast, useAuth, useGeolocation, useTeluguTyping, useWelcome tour) 6 test files

ashritha kunjeti requested to merge test/hooks into test_cases

Description:

use-mobile.test.tsx

Tests the useIsMobile hook to ensure it correctly detects mobile vs desktop screens by simulating screen sizes, resizing behavior, and cleaning up event listeners properly.

use-toast.test.ts

Tests the useToast hook to ensure notifications work correctly, including adding, updating, limiting to one toast, auto-removal using timers, and handling edge cases for full reliability.

useAuth.test.tsx

Tests the useAuth hook to ensure robust authentication workflows, verifying secure token storage, API interceptor injection, user profile data fetching fallbacks, and comprehensive error handling during both login and logout states.

useGeolocation.test.ts

Tests the useGeolocation hook to confirm accurate location tracking by simulating native browser navigator APIs, properly mapping varied permission errors or unsupported environments, and validating coordinate updates and loading states.

useGeolocation.ts : Updated to return setCoordinates so components can properly access and use it.

useTeluguTyping.test.tsx

Tests the useTeluguTyping hook to validate accurate phonetic character transliteration, ensuring exact cursor sequence parsing, handling complex vowel and consonant combinations, filtering valid suggestions, and dynamically replacing text bounds without breaking on modifier keys.

useWelcomeTour.test.ts

Tests the useWelcomeTour hook to guarantee the onboarding popover driver triggers and routes successfully across the application, verifying local storage startup conditions, complete step sequencing, and executing correct timeout routing delays seamlessly.

Type of Change:

  • Bug Fix
  • Feature Development
  • Documentation

Testing:

  • Tested on desktop
  • Tested on mobile
  • Tested in different browsers

Screenshots (if applicable): image

Checklist:

  • Code follows project style guidelines
  • Self-review completed
  • No console errors
  • TypeScript types are correct

*Closes #259 (closed)

Edited by ashritha kunjeti

Merge request reports

Loading