Skip to content

test : added unit tests for streak.ts#2776

Merged
Priyanshu-byte-coder merged 1 commit into
Priyanshu-byte-coder:mainfrom
tmdeveloper007:#2771
Jun 24, 2026
Merged

test : added unit tests for streak.ts#2776
Priyanshu-byte-coder merged 1 commit into
Priyanshu-byte-coder:mainfrom
tmdeveloper007:#2771

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Closes #2771.

Summary of What Has Been Done:
Added comprehensive unit tests for the streak calculation functions in src/lib/streak.ts: calculateStreakFromDates(), calculateCurrentStreak(), and calculateStreak().

Changes Made:

  • Added test/streak.test.ts with 10 test cases across 3 describe blocks
  • calculateStreakFromDates(): empty input, single day, consecutive streak, gap breaks, freeze dates bridging gaps, current streak zero when last active is older than yesterday
  • calculateCurrentStreak(): Set and array input, deduplication of ISO timestamps, empty input returns 0
  • calculateStreak(): Date[] adapter, delegates to calculateStreakFromDates

Impact it Made:
Improves test coverage for the streak calculation system that powers the user dashboard streak widgets. Ensures consecutive-day counting and freeze-date handling are accurate.

@github-actions github-actions Bot added type:testing GSSoC type bonus: tests (+10 pts) gssoc26 GSSoC 2026 contribution labels Jun 24, 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 Priyanshu-byte-coder merged commit 2bc0721 into Priyanshu-byte-coder:main Jun 24, 2026
17 checks passed
@github-actions

Copy link
Copy Markdown

🎉 Merged! Thanks for contributing to DevTrack.

If the project has been useful to you, a ⭐ star on the repo is the easiest way to support it — it helps DevTrack get discovered by more developers.

Keep an eye on open issues for your next contribution!

@Priyanshu-byte-coder Priyanshu-byte-coder added gssoc:approved GSSoC: PR approved for scoring level1 GSSoC Level 1 - Beginner (10 points) labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC: PR approved for scoring gssoc26 GSSoC 2026 contribution level1 GSSoC Level 1 - Beginner (10 points) 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 streak.ts

2 participants