Skip to content

test : added unit tests for repo-analytics-utils and digest-email builders - #2633

Closed
tmdeveloper007 wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
tmdeveloper007:#2628
Closed

test : added unit tests for repo-analytics-utils and digest-email builders#2633
tmdeveloper007 wants to merge 2 commits into
Priyanshu-byte-coder:mainfrom
tmdeveloper007:#2628

Conversation

@tmdeveloper007

@tmdeveloper007 tmdeveloper007 commented Jun 21, 2026

Copy link
Copy Markdown

Closes #2628.

Summary of What Has Been Done:
Added two vitest test files covering untested modules in src/lib/. All 45 tests pass under vitest.

Changes Made:

  • test/repo-analytics-utils.test.ts (20 tests): parseRepoParam for all valid/invalid GitHub repository identifier cases including boundary lengths, whitespace trimming, dot-only segments, and extra slashes.
  • test/digest-email.test.ts (25 tests): buildDigestHtml and buildDigestText for all rendering states including metrics/no-metrics, empty language/repo sections, HTML escaping, and pluralisation.

Impact it Made:
repo-analytics-utils: parseRepoParam is the first gate in /api/metrics/repos and /api/metrics/repo-explorer. digest-email: the weekly digest email renders without crashing regardless of which metric fields are populated, and HTML entities in user data are properly escaped to prevent injection in email clients.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:testing GSSoC type bonus: tests (+10 pts) labels Jun 21, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Umbrella-io — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

CI is failing on this PR. Please fix the TypeScript/test errors before we can merge. Run npm run typecheck and npm test locally to reproduce.

@tmdeveloper007

Copy link
Copy Markdown
Author

This PR has been closed as it has been stale for more than 2 days without recent activity or merging. If this work is still relevant, please reopen a fresh PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test : add unit tests for repo-analytics-utils and digest-email builders

2 participants