Skip to content

[quality] add unit tests for analytics-accm helpers, pipelines helpers, and layout utils#19652

Merged
clubanderson merged 4 commits into
mainfrom
quality/test-untested-helpers
Jun 25, 2026
Merged

[quality] add unit tests for analytics-accm helpers, pipelines helpers, and layout utils#19652
clubanderson merged 4 commits into
mainfrom
quality/test-untested-helpers

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds 52 unit tests across 3 new test files for previously untested pure utility functions:

analytics-accm-helpers.test.ts (20 tests)

  • isoWeek: ISO week string formatting, year boundaries
  • lastNWeeks: chronological ordering, uniqueness, current-week anchoring
  • weeksSinceProjectStart: minimum value, growth over time, MAX cap
  • daysSinceProjectStart: correct day count from project start
  • isAIContribution: AI authors, bot suffix, label detection, null safety

github-pipelines-helpers.test.ts (16 tests)

  • jsonResponse: Content-Type header, status codes, body serialization, custom headers
  • isValidRepo: owner/repo format, special chars, null, injection patterns
  • isAllowedRepo: format validation, allowlist enforcement, case insensitivity

layouts.test.ts (16 tests)

  • All 6 layout utility functions: default gaps, custom gaps, string gaps
  • LAYOUTS constants: cross-validation against function defaults

Fixes #19651
Partially addresses #19631


Filed by quality agent (ACMM L4/L6 — full mode)

…s, and layout utils

Adds 52 unit tests across 3 new test files for previously untested pure
utility functions:

- analytics-accm/helpers: isoWeek, lastNWeeks, weeksSinceProjectStart,
  daysSinceProjectStart, isAIContribution (20 tests)
- github-pipelines/helpers: jsonResponse, isValidRepo, isAllowedRepo
  (16 tests, includes injection-prevention checks)
- lib/utils/layouts: flexCenter, flexStart, flexWrapBetween,
  flexCenterJustify, flexCol, flexColCenter, LAYOUTS constants (16 tests)

Partially addresses #19631

Signed-off-by: kubestellar-hive[bot] <kubestellar-hive[bot]@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 25, 2026 21:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Jun 25, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign mikespreitzer for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify

netlify Bot commented Jun 25, 2026

Copy link
Copy Markdown

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit 0945d22
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/6a3db93d3c50be0008a936f1
😎 Deploy Preview https://deploy-preview-19652.console-deploy-preview.kubestellar.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hey @kubestellar-hive[bot] — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 25, 2026
@github-actions github-actions Bot added the ai-generated Pull request generated by AI label Jun 25, 2026
Tests aggregateWeeklyActivity, aggregateCIPassRates, and
aggregateContributorGrowth with mock PR/issue/workflow data.

Covers: week bucketing, merge-week attribution, AI vs human
classification, unique contributor tracking, CI pass rate
calculation, contributor growth accumulation, and pre-window
contributor counting.

Signed-off-by: kubestellar-hive[bot] <kubestellar-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 25, 2026
@kubestellar-hive

Copy link
Copy Markdown
Contributor Author

Updated: added 18 more tests for analytics-accm/aggregation.ts — total is now 70 tests across 4 files.

*
* Run: cd web && npx vitest run netlify/functions/__tests__/github-pipelines-helpers.test.ts
*/
import { describe, expect, it, vi } from "vitest";
@clubanderson clubanderson merged commit 4435c9c into main Jun 25, 2026
24 of 27 checks passed
@kubestellar-prow kubestellar-prow Bot deleted the quality/test-untested-helpers branch June 25, 2026 23:27
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

@github-actions

Copy link
Copy Markdown
Contributor

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit 4435c9c56acc450219be021f76a1e8efb0ec464f.

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

Labels

ai-generated Pull request generated by AI dco-signoff: yes Indicates the PR's author has signed the DCO. quality size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. testing tier/1-lightweight

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] Pure utility functions in analytics-accm, github-pipelines, and layout utils have zero test coverage

2 participants