Skip to content

test: add Vitest unit tests for location-detector and country-flags - #238

Merged
O2sa merged 1 commit into
O2sa:mainfrom
Ghifariezra:test/geo-helpers-232
Oct 11, 2026
Merged

O2sa merged 1 commit into
O2sa:mainfrom
Ghifariezra:test/geo-helpers-232

Conversation

@Ghifariezra

Copy link
Copy Markdown
Contributor

Fixes #232

Additionally, at the time of submission of this PR:

  • The referred issue is not blocked currently
  • All unittests passed after changes were made

Summary

Adds Vitest unit tests for detectCountry (location-detector.ts) and getCountryCode (country-flags.ts).

Coverage

  • Exact matches (country names and major cities), case-insensitivity, whitespace and punctuation handling
  • Word-boundary cases (e.g. Romania vs Oman, Somalia vs Mali, Nigeria vs Niger)
  • Edge cases: null, empty, whitespace-only, special characters
  • getCountryCode for valid slugs, unknown slugs, and slugs with an empty ISO code

Verification

  • pnpm test: 24 files, 198 tests passed
  • pnpm lint: no errors

@vercel

vercel Bot commented Oct 11, 2026

Copy link
Copy Markdown

@Ghifariezra is attempting to deploy a commit to the osama's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown

Thank you for the pull request! ✅

A maintainer will review this soon. Please be patient while we take a look. 🙌

@O2sa
O2sa merged commit 1bd9641 into O2sa:main Oct 11, 2026
2 of 3 checks passed
@O2sa

O2sa commented Oct 11, 2026

Copy link
Copy Markdown
Owner

🎊 Welcome, @Ghifariezra! Your first contribution has been merged! 🚀

Thank you for helping improve the project! If you find this tool useful, please consider giving us a ⭐ star on GitHub—it helps more developers find our work and motivates us to keep improving!

@Ghifariezra

Copy link
Copy Markdown
Contributor Author

Thanks for the quick review and merge, @O2sa! Glad to contribute. ⭐ Starred the repo.

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.

test: Add Vitest unit tests for location-detector and country-flags helpers

2 participants