test: add unit tests for wrapped year-summary utility functions (#2720)#2736
Open
desireddymohithreddy0925 wants to merge 2 commits into
Open
test: add unit tests for wrapped year-summary utility functions (#2720)#2736desireddymohithreddy0925 wants to merge 2 commits into
desireddymohithreddy0925 wants to merge 2 commits into
Conversation
GSSoC Label Checklist 🏷️@Umbrella-io — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves #2720
This PR adds comprehensive unit testing for the pure utility functions exported from
src/lib/wrapped.tsusing Vitest. It ensures predictable analytics generation for the year-in-review (Wrapped) functionality.Changes Made
test/wrapped.test.ts:getYearRange: Checked past full year boundaries, current partial year bounds, and leap years.calculateLongestStreak: Mocked@/lib/streakto confirm empty cases, single active days, and multiple active days.getMostProductiveMonth: Verified single highest month, uniform contributions, and tie-breaking behavior (index 0).getMostContributedRepo: Checked empty commit arrays, single repos, and correctly ranked multiple repositories.getPeakCodingHour: Validated empty/invalid datasets, single hour entries, tie-breaks via index, and correctly formatted 12-hour AM/PM string formats.calculateLanguagePercentages: Ensured single/multiple languages sort by bytes descending, respects limits, and guards against zero total bytes gracefully.calculatePersonality: Guaranteed deterministic output shapes and emojis across all identities: Weekend Warrior, Night Architect, Sprint Builder, Silent Architect, and Consistency Monk.Acceptance Criteria
@/lib/streakdependency successfully forcalculateLongestStreak.vitest.