[jsweep] Clean allowed_extensions_helpers.cjs#28548
Conversation
Add 16 more test cases covering: - isGitHubExpression: whitespace trimming, no-inner-space expr, empty/plain string, trailing text - normalizeAllowedExtension: empty input, already-dotted ext, expression passthrough, mixed case - parseAllowedExtensionsEnv: empty string, single ext, expression-only, blank-value filtering Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Expands unit test coverage for the allowed_extensions_helpers.cjs Node.js utility that detects GitHub Actions expressions and normalizes/parses extension allow-lists.
Changes:
- Added additional
isGitHubExpressioncases (whitespace handling, no-inner-space expressions, empty/plain strings, trailing text). - Added additional
normalizeAllowedExtensioncases (empty input, already-dotted values, expression passthrough, mixed case). - Added additional
parseAllowedExtensionsEnvcases (empty string handling, single value parsing, expression-only inputs, filtering blanks post-normalization).
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/allowed_extensions_helpers.test.cjs | Adds comprehensive edge-case coverage across the three exported helper functions. |
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
🧪 Test Quality Sentinel ReportTest Quality Score: 100/100✅ Excellent test quality
Test Classification DetailsView all 14 test classifications
Flagged Tests — Requires ReviewNone. All 14 new tests are clean. Language SupportTests analyzed:
Verdict
📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does:
Implementation Tests (Low Value) verify how the system does it:
Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators. References: §24953920420
|
Summary
Expanded test coverage for
allowed_extensions_helpers.cjs, a Node.js utility (no github-script context) that normalizes file extension allow-lists in workflow configurations.The source file was already clean and modern (
@ts-check, optional chaining, functional patterns). This sweep focused on bringing test coverage up to a comprehensive level.Changes
allowed_extensions_helpers.test.cjsGrew from 5 → 21 test cases across all three exported functions:
isGitHubExpressionnormalizeAllowedExtensionparseAllowedExtensionsEnvNew edge cases covered:
isGitHubExpression: surrounding whitespace trimming, expression with no inner spaces, empty string, plain extension, expression with trailing textnormalizeAllowedExtension: empty string input, already-dotted extension, GitHub expression passthrough (unchanged), mixed-case extensionparseAllowedExtensionsEnv: empty string returns null, single extension, expression-only input, blank values filtered from normalizedValuesValidation ✅
npm run format:cjs✓npm run lint:cjs✓npm run typecheck✓npx vitest run allowed_extensions_helpers)