test: add comprehensive unit tests for streak calculation utilities#2746
test: add comprehensive unit tests for streak calculation utilities#2746Shanidhya01 wants to merge 43 commits into
Conversation
GSSoC Label Checklist 🏷️@Umbrella-io — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
Legit-Ox
left a comment
There was a problem hiding this comment.
Test coverage is solid — good edge case variety across leap years, month transitions, timezone boundaries, and freeze dates. Three issues before merging:
rolldownadded to productiondependencies— unrelated to this PR and shouldn't be there at all- One test name directly contradicts its assertion
package-lock.jsonaccidentally narrows the Node engine range
|
Ok will fix it by the end of the day |
…est/streak-calculation-1069
Swap hardcoded stats table for dynamic shields.io badges (stars, forks), add komarev view counter, and remove good-first-issues badge.
- Remove duplicate ThemeToggle from hero section (navbar-only now) - Fix hardcoded Priyanshu-byte-coder#222 footer color → use MUTED CSS variable for dark mode - Add missing lnd-footer-link CSS class - Deduplicate lnd-cta-secondary CSS rule - Remove unused ThemeToggle import
- Remove duplicate widget section that rendered everything twice - Move orphaned sidebar into proper 2-column grid (1fr + 320px) - Standardize spacing with space-y-8 wrapper - Fix duplicate id="goals" → id="goals-insights" - Fix StreakTracker break-all → tabular-nums (numbers no longer break mid-digit) - Fix PRMetrics lg:grid-cols-6 → lg:grid-cols-3 (readable stat cards) - Make CodingActivityInsightsCard chart height responsive - Remove 7 dead imports and 2 unused dynamic components
…e range, fix test name - Remove rolldown from dependencies (build tool, not a runtime lib) - Restore engines.node to >=20.0.0 to avoid excluding Node 22/24 - Rename misleading test that said does not treat Feb 28 → Mar 1 as consecutive when the assertion proves they are consecutive in a non-leap year
All 11 widgets that were rendered directly in page.tsx are already handled by CustomizableDashboard with better skeletons, error boundaries, and ssr:false. Removed duplicates: - RepoAnalyticsExplorer, PRMetrics, CommunityMetrics - PRBreakdownChart, CommitTimeChart, ActivityRingChart - CodingActivityInsightsCard, PRReviewTrendChart - StreakTracker, LocalCodingTime, CodingTimeWidget Kept RoastHypeWidget (not in CustomizableDashboard). Deleted DashboardWidgets.tsx (dead code, zero importers). page.tsx: 245 → 152 lines.
…r#2709) Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4 to 6. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v4...v6) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…der#2711) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@v3...v4) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…2710) Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v4...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…der users (Priyanshu-byte-coder#2783) Adds a visually-hidden skip navigation link as the first focusable element in the root layout, targeting #main-content so keyboard-only users can bypass the navbar. Wraps page children with the skip target div and promotes the dashboard's top-level container to a semantic <main> element.
…r#2777) Co-authored-by: tmdeveloper007 <tmdeveloper007@users.noreply.github.com>
Co-authored-by: tmdeveloper007 <tmdeveloper007@users.noreply.github.com>
…anshu-byte-coder#2725) Co-authored-by: tmdeveloper007 <tmdeveloper007@users.noreply.github.com>
…hu-byte-coder#2722) (Priyanshu-byte-coder#2733) Co-authored-by: DESIREDDY MOHITH REDDY <desireddymohithreddy@MRD-2.local>
…anshu-byte-coder#2603) (Priyanshu-byte-coder#2741) WIDGET_SPAN_CLASSES uses xl:col-span-2 on several widgets but the parent section grids had no xl:grid-cols-N, so those col-span rules had no grid context at viewports >=1280px. The rendered layout therefore diverged from the skeleton (which has no span classes) at ultra-wide viewports, causing the visible layout shift on hydration. - Add xl:grid-cols-3 to activity and goals sections (which contain xl:col-span-2 widgets) so column spans are meaningful at xl breakpoints - analytics already had xl:grid-cols-3 (correct) - Add min-h-[280px] to ChartSkeleton and min-h-[200px] to SkeletonCard so skeleton height is stable on auto-rows-max grids before hydration - Fix sectionWidgets indentation inside .map() callback (formatting only)
…Others (Priyanshu-byte-coder#2605) (Priyanshu-byte-coder#2740) - Languages with < 1% share are collapsed into a single 'Others' bucket - Named languages are capped at 6 maximum; any beyond rank 6 also collapse into 'Others' regardless of their share - Donut chart centre label now shows the true total language count from the API, not the capped display count, so users can see they have more - Rounding remainder is absorbed into 'Others' to keep the donut complete - Prevents the legend overflowing its card container on 10+ language profiles
|
The test coverage here is genuinely strong — the timezone edge cases, leap year handling, and streak-utils coverage are valuable. A few things to fix before merge:
Fix these and the test quality is solid enough to merge. |
- sanitize.ts: run stripHtml iteratively until stable, preventing nested/split-tag bypass (CodeQL js/incomplete-multi-character-sanitization) - project-tutor/route.ts: encodeURIComponent on owner/repo before embedding in GitHub API URLs (CodeQL js/request-forgery Priyanshu-byte-coder#6-8) - MembersPanel.tsx: encodeURIComponent on github_username in img src (CodeQL js/xss-through-dom Priyanshu-byte-coder#17) - README.md: replace all stale Umbrella-io/devtrack refs with Priyanshu-byte-coder/devtrack
Move security overrides into pnpm.overrides (the overrides field was npm-only and ignored by pnpm). Forces: - serialize-javascript >=7.0.3 (HIGH RCE via RegExp, GHSA-5c6j-r48x-rmvq) - postcss >=8.4.31 (XSS via unescaped </style>, GHSA-qx2v-qp2m-jg93) - uuid >=9.0.1 (buffer bounds, GHSA-w5hq-g745-h8pq) - js-yaml >=4.1.0 (quadratic DoS, GHSA-h67p-54hq-rp68)
…errides pnpm 11 moved overrides from package.json to pnpm-workspace.yaml. Lockfile regenerated — vulnerable old versions eliminated: - serialize-javascript 4.0.0/6.0.2 -> 7.0.6 (HIGH RCE GHSA-5c6j-r48x-rmvq) - js-yaml 3.14.2 removed (quadratic DoS GHSA-h67p-54hq-rp68) - postcss/uuid already at patched versions Also approve needed native build deps in allowBuilds.
…iyanshu-byte-coder#2706) * fix: replace npm with pnpm in README and ignore package-lock.json * ci: update github workflows to use pnpm * ci: fix missing pnpm/action-setup in github workflows * chore: approve native build scripts for pnpm * ci: remove global pnpm install to use setup action version --------- Co-authored-by: DESIREDDY MOHITH REDDY <desireddymohithreddy@MRD-2.local>
…coder#2703) Co-authored-by: tmdeveloper007 <tmdeveloper007@users.noreply.github.com>
…coder#2702) Co-authored-by: tmdeveloper007 <tmdeveloper007@users.noreply.github.com>
…yanshu-byte-coder#2700) Co-authored-by: tmdeveloper007 <tmdeveloper007@users.noreply.github.com>
pnpm 9 does not read overrides from pnpm-workspace.yaml, causing ERR_PNPM_LOCKFILE_CONFIG_MISMATCH on frozen install. pnpm 11 is the version in use locally and is the correct version for this lockfile.
- Accept package-lock.json deletion (project uses pnpm) - Revert engines.node to "20.x" (no scope change) - Resolve test/streak.test.ts conflict by keeping upstream version (Priyanshu-byte-coder#2776) - Add test/streak-comprehensive.test.ts with our timezone/leap-year/freeze tests
Our comprehensive tests live in test/streak-comprehensive.test.ts.
30a9a28 to
7df0840
Compare
Summary
Adds comprehensive unit tests for streak calculation utility functions to improve reliability and prevent regressions in DevTrack's streak tracking system.
Closes #1069
Changes Made
Test Coverage
Covered scenarios:
Type of Change
Checklist