Skip to content

Add Unit Tests for GitHub Username Validation - #9030

Merged
JhaSourav07 merged 1 commit into
JhaSourav07:mainfrom
Rakshak05:issue-#8368
Aug 18, 2026
Merged

Add Unit Tests for GitHub Username Validation#9030
JhaSourav07 merged 1 commit into
JhaSourav07:mainfrom
Rakshak05:issue-#8368

Conversation

@Rakshak05

Copy link
Copy Markdown
Contributor

Description

Fixes #8368

Added a dedicated unit test file lib/validations.github-username.test.ts to provide comprehensive test coverage for validateGitHubUsername.

Tests cover:

  • Valid usernames (simple, hyphenated, numeric, mixed-case, max length of 39 chars)
  • Invalid usernames (empty, null, undefined, non-string types, special characters, leading/trailing hyphens, consecutive hyphens, exceeding length limit, spaces, underscores)
  • Real GitHub usernames for positive cases

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

N/A (Unit tests only)

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have started the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

Copilot AI lite review requested due to automatic review settings August 14, 2026 08:17
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

@Rakshak05 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@retenta-bot

retenta-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown

This PR enhances the testing coverage for username validation, which is crucial for maintaining data integrity and user experience. It aligns with previous decisions to improve username normalization across various APIs. Thank you for your contribution!

@retenta-bot retenta-bot Bot changed the title test(validations): add unit tests for validateGitHubUsername (#8368) Add Unit Tests for GitHub Username Validation Aug 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

✨ No significant bundle size changes detected.

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 5004.32 KB 5004.32 KB 0 B
Total CSS 354.80 KB 354.80 KB 0 B

@Aamod007 Aamod007 added mentor:Aamod007 type:testing Adding, updating, or fixing tests level:beginner Small changes Usually isolated fixes or simple UI/text updates. quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. labels Aug 16, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very comprehensive test suite for GitHub username validation! The negative cases are well thought out and perfectly ensure that our security and length validations won't regress. Approved!

@JhaSourav07 JhaSourav07 added the gssoc:approved PR has been reviewed and accepted for valid contribution points label Aug 18, 2026
@JhaSourav07
JhaSourav07 merged commit 95d15da into JhaSourav07:main Aug 18, 2026
11 of 12 checks passed
@github-actions github-actions Bot added this to the GSSoC 2026 milestone Aug 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @Rakshak05! Your PR has been successfully merged. 🚀

Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.

⚠️ Important for GSSoC Contributors:
You are strictly advised to join our Discord Server as it is mandatory for all GSSoC participants. All important announcements, point claims, and community discussions happen there.

Keep building! 💻✨

@Rakshak05
Rakshak05 deleted the issue-#8368 branch August 19, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved PR has been reviewed and accepted for valid contribution points level:beginner Small changes Usually isolated fixes or simple UI/text updates. mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test : add unit tests for validateGitHubUsername function

4 participants