Skip to content

test: add non-mutation coverage for mergeCommitCounts (#2988)#3195

Open
aaniya22 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
aaniya22:test/2988-developer-persona-unit-tests
Open

test: add non-mutation coverage for mergeCommitCounts (#2988)#3195
aaniya22 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
aaniya22:test/2988-developer-persona-unit-tests

Conversation

@aaniya22

Copy link
Copy Markdown

Summary

Adds one missing test case to test/developer-persona.test.ts: verifies that mergeCommitCounts does not mutate its input objects when merging overlapping dates, as called out in issue #2988.

Closes #2988


Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📝 Documentation update
  • ♻️ Refactor / code cleanup (no functional change)
  • ⚡ Performance improvement
  • 🔒 Security fix
  • 🧪 Tests only

What Changed

  • test/developer-persona.test.ts — added a new test in the mergeCommitCounts describe block: "should not mutate the original input objects". It snapshots both input maps before calling mergeCommitCounts(a, b) and asserts they're unchanged afterward.

How to Test

  1. Pull this branch.
  2. Run pnpm install (use --ignore-scripts if the optional tree-sitter native build fails on your machine — it's unrelated to this change).
  3. Run npx vitest run test/developer-persona.test.ts.

Expected result: All 26 tests in the file pass, including the new non-mutation test for mergeCommitCounts.


Screenshots / Recordings

Not applicable — this is a test-only change with no UI impact.


Checklist

  • Linked the related issue above
  • Self-reviewed my own diff
  • No unnecessary console.log, debug code, or commented-out blocks
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Added or updated tests where applicable
  • Updated documentation / comments if behavior changed

Accessibility (UI changes only)

Not applicable — no UI changes.


Additional Context

Most of the coverage requested in #2988calculateStreaks, formatDurationHours, choosePersonaCandidate, mergeCommitCounts (sum behavior), and mergeSignals — already exists in test/developer-persona.test.ts on main. This PR adds the one gap I found while reviewing: an explicit assertion that mergeCommitCounts doesn't mutate its inputs, which the issue mentions but wasn't previously tested. Flagging this so reviewers aren't surprised the diff is small relative to the issue's original scope.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts) labels Jul 13, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — 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

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

Labels

gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature 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 developer-persona.ts

1 participant