Skip to content

[jsweep] Clean check_runs_helpers: add comprehensive test coverage#27973

Merged
pelikhan merged 1 commit intomainfrom
jsweep/check-runs-helpers-tests-7b81d1a074782b32
Apr 23, 2026
Merged

[jsweep] Clean check_runs_helpers: add comprehensive test coverage#27973
pelikhan merged 1 commit intomainfrom
jsweep/check-runs-helpers-tests-7b81d1a074782b32

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Summary

Added comprehensive test coverage for check_runs_helpers.cjs, which previously had no test file.

File: check_runs_helpers.cjs

Context: Pure Node.js utility module (no github-script context)

What was improved:

  • Created check_runs_helpers.test.cjs with 17 tests covering all exported functions

Test Coverage Added

Function Tests Added
isDeploymentCheck 4 tests: deployment slug, non-deployment, absent app, null/undefined
selectLatestRelevantChecks 7 tests: latest-per-name deduplication, deployment filtering, excludedCheckRunIds, includeList, excludeList, empty input, empty includeList
getFailingChecks 6 tests: failure/cancelled/timed_out, success exclusion, pending allowance, null conclusion

Validation Checks

  • ✅ Formatting: npm run format:cjs — passed
  • ✅ Linting: npm run lint:cjs — passed
  • ✅ Type checking: npm run typecheck — passed
  • ✅ Tests: npx vitest run check_runs_helpers.test.cjs — 17/17 passed

Generated by jsweep - JavaScript Unbloater · ● 1.3M ·

  • expires on Apr 25, 2026, 4:55 AM UTC

Add 17 tests covering isDeploymentCheck, selectLatestRelevantChecks,
and getFailingChecks functions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review April 23, 2026 05:21
Copilot AI review requested due to automatic review settings April 23, 2026 05:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Vitest test suite to provide coverage for the pure Node.js utility module check_runs_helpers.cjs.

Changes:

  • Added actions/setup/js/check_runs_helpers.test.cjs covering isDeploymentCheck, selectLatestRelevantChecks, and getFailingChecks.
  • Validated key behaviors including deployment filtering, latest-per-name selection, include/exclude lists, excluded IDs, and pending/failing semantics.
Show a summary per file
File Description
actions/setup/js/check_runs_helpers.test.cjs Introduces comprehensive unit tests for all exported helpers in check_runs_helpers.cjs.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@github-actions github-actions Bot mentioned this pull request Apr 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor Author

🧪 Test Quality Sentinel Report

Test Quality Score: 89/100

Excellent test quality

Metric Value
New/modified tests analyzed 17
✅ Design tests (behavioral contracts) 17 (100%)
⚠️ Implementation tests (low value) 0 (0%)
Tests with error/edge cases 12 (71%)
Duplicate test clusters 0
Test inflation detected No (test-only PR — existing production file not modified)
🚨 Coding-guideline violations None

Test Classification Details

View all 17 test classifications
Test File Classification Issues Detected
isDeploymentCheck – returns true when app slug is github-deployments check_runs_helpers.test.cjs:10 ✅ Design None
isDeploymentCheck – returns false for non-deployment check runs check_runs_helpers.test.cjs:14 ✅ Design None
isDeploymentCheck – returns false when app is absent check_runs_helpers.test.cjs:18 ✅ Design (edge case) None
isDeploymentCheck – returns false for null/undefined check_runs_helpers.test.cjs:22 ✅ Design (edge case) None
selectLatestRelevantChecks – returns the latest run per name check_runs_helpers.test.cjs:40 ✅ Design None
selectLatestRelevantChecks – excludes deployment checks and reports count check_runs_helpers.test.cjs:46 ✅ Design None
selectLatestRelevantChecks – excludes runs in excludedCheckRunIds check_runs_helpers.test.cjs:52 ✅ Design None
selectLatestRelevantChecks – filters by includeList check_runs_helpers.test.cjs:59 ✅ Design None
selectLatestRelevantChecks – filters by excludeList check_runs_helpers.test.cjs:65 ✅ Design None
selectLatestRelevantChecks – returns empty array for empty input check_runs_helpers.test.cjs:70 ✅ Design (edge case) None
selectLatestRelevantChecks – ignores empty includeList (includes everything) check_runs_helpers.test.cjs:77 ✅ Design (edge case) None
getFailingChecks – includes failure, cancelled, and timed_out conclusions check_runs_helpers.test.cjs:96 ✅ Design (error cases) None
getFailingChecks – excludes success conclusion check_runs_helpers.test.cjs:104 ✅ Design None
getFailingChecks – includes pending runs when allowPending is false (default) check_runs_helpers.test.cjs:109 ✅ Design None
getFailingChecks – excludes pending runs when allowPending is true check_runs_helpers.test.cjs:114 ✅ Design None
getFailingChecks – excludes completed run with null conclusion check_runs_helpers.test.cjs:119 ✅ Design (edge case) None
getFailingChecks – returns empty array when no checks fail check_runs_helpers.test.cjs:124 ✅ Design (edge case) None

Flagged Tests — Requires Review

No tests were flagged. All 17 tests verify observable behavioral contracts.


Scoring Breakdown

Component Score Notes
Behavioral coverage (40 pts) 40/40 17/17 tests are design tests
Error/edge case coverage (30 pts) 19/30 12/17 tests include error or edge case assertions
Low duplication (20 pts) 20/20 No duplicate clusters detected
Proportional growth (10 pts) 10/10 Test-only PR; existing production file untouched

Language Support

Tests analyzed:

  • 🟨 JavaScript (*.test.cjs): 17 tests (vitest) — actions/setup/js/check_runs_helpers.test.cjs

No Go tests were added or modified in this PR.


Verdict

Check passed. 0% of new tests are implementation tests (threshold: 30%). All 17 tests verify observable behavioral contracts across three functions (isDeploymentCheck, selectLatestRelevantChecks, getFailingChecks). Coverage is strong across happy-path, filtering logic, edge cases (empty input, null/undefined, missing fields), and conclusion-type variants.


📖 Understanding Test Classifications

Design Tests (High Value) verify what the system does:

  • Assert on observable outputs, return values, or state changes
  • Cover error paths and boundary conditions
  • Would catch a behavioral regression if deleted
  • Remain valid even after internal refactoring

Implementation Tests (Low Value) verify how the system does it:

  • Assert on internal function calls (mocking internals)
  • Only test the happy path with typical inputs
  • Break during legitimate refactoring even when behavior is correct
  • Give false assurance: they pass even when the system is wrong

Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.

References: §24818328990

🧪 Test quality analysis by Test Quality Sentinel · ● 385.2K ·

Copy link
Copy Markdown
Contributor Author

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 89/100. Test quality is excellent — 0% of new tests are implementation tests (threshold: 30%). All 17 tests verify observable behavioral contracts with strong edge case coverage.

@pelikhan pelikhan merged commit 52efb4a into main Apr 23, 2026
28 checks passed
@pelikhan pelikhan deleted the jsweep/check-runs-helpers-tests-7b81d1a074782b32 branch April 23, 2026 05:25
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.

2 participants