Skip to content

test: added test cases for constants, points and telugukeyboard

Description:

Added comprehensive unit test coverage for core utility modules to improve reliability and ensure correct functionality.

  • constants.test.ts (13 tests): Verified BACKEND_URL constant behavior including environment variable mapping (VITE_API_SERVER_URL), type validation, immutability, module exports, and URL edge cases (trailing slashes, ports, API paths).

  • points.test.ts (40 tests): Tested API functions for user points and leaderboard:

    • getPointsToday()
    • getPointsStats()
    • getStreakStatus()
    • getGlobalLeaderboard() Covered success responses, error handling, empty data scenarios, and type validation using mocked API calls.
  • teluguKeyboard.test.ts (145 tests): Extensive testing of Telugu transliteration engine:

    • Initialization and transliteration logic
    • Vowels, consonants, compound characters, and combinations
    • Multi-syllable words and edge cases
    • Suggestions, vowel combinations, base consonant extraction Achieved high coverage (~91.63% statements, 100% functions)

These tests significantly improve confidence in shared logic used across the application.


Type of Change:

  • Bug Fix
  • Feature Development
  • Documentation

Testing:

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

Screenshots (if applicable):

Screenshot_from_2026-03-26_15-17-33


Checklist:

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

closes #264 (closed)

Merge request reports

Loading