Skip to content

test: add unit tests for pr-volume-bucketing (re #885) - #901

Open
Ishaan-Gpt wants to merge 1 commit into
Coder-s-OG-s:mainfrom
Ishaan-Gpt:test-pr-volume-bucketing-885
Open

Ishaan-Gpt wants to merge 1 commit into
Coder-s-OG-s:mainfrom
Ishaan-Gpt:test-pr-volume-bucketing-885

Conversation

@Ishaan-Gpt

Copy link
Copy Markdown

Summary

Adds unit tests for the PR volume bucketing helper in src/lib/maintainer/pr-volume-bucketing.ts, covering one file from the #885 checklist (one test file per PR).

Type of Change

  • Bug fix
  • New feature
  • UI / UX improvement
  • Refactor
  • Documentation
  • Other (unit tests)

Related Issue

Related to #885

What was changed?

New file src/lib/maintainer/pr-volume-bucketing.test.ts (16 tests):

  • Bucket layout: one bucket per day for 7d/30d, weekly buckets for 90d, monthly buckets with "Mon YYYY" labels for all; empty input starts every counter at zero; the function never mutates its date arguments.
  • Merged counts: a merged PR lands in the bucket containing its mergedAt; merges outside the window (before from, at or after to) are ignored; weekly and monthly bucketing place merges correctly.
  • AI blocked counts: a flagged PR counts toward the bucket containing its creation date; unflagged PRs are skipped.
  • Stalled counts: a PR goes stale 14 days after its last update and is counted in every bucket while it stays open; it drops out of the stalled count after being closed; a PR closed before the window is never counted.

Screenshots

Not applicable (no UI changes).

Checklist

  • My code follows the project structure and conventions
  • I tested this locally (npx vitest run src/lib/maintainer/pr-volume-bucketing.test.ts — 16/16 pass)
  • No hardcoded secrets or credentials
  • I have updated documentation if needed
  • npx prettier --check passes on the new file; tsc --noEmit shows no new errors

Covers one file from the Coder-s-OG-s#885 checklist: bucket layout (daily, weekly,
monthly ranges), merged and aiBlocked counting, and the 14-day stalled
logic. All 16 tests pass locally.
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

This PR has had no activity for 7 days. Are you still working on it? If so, please push an update or leave a comment. Otherwise it will be labeled stale in another 7 days.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant