Repository navigation
test(static-references): exercise every static-asset detection path - #735
Closed
hivecommons-hive[bot] wants to merge 1 commit into
Closed
hivecommons-hive[bot] wants to merge 1 commit into
hivecommons-hive[bot] wants to merge 1 commit into
Conversation
tests/static-assets.test.mjs asserted six static-asset contracts but never exercised the branches that report a violation: describe(), the missing, not-a-file, zero-byte, case-mismatch, traversal and CNCFProjectCard logo push sites were all uncovered (89.06% lines / 85.71% regions). Its only guard against becoming vacuous was REFERENCES.size > 20, which catches a scan that finds nothing but not one that quietly stops finding the broken references. Move the scan and the five checkers into tests/tools/static-references.mjs, parameterised by root, so the contract test keeps asserting them against the real repository while tests/static-references.test.mjs drives each one against fixture trees that really do contain a missing, zero-byte, case-mismatched, escaping and unresolvable reference. All three files now report 100% line and region coverage. Signed-off-by: hivecommons-hive[bot] <hivecommons-hive@hive.kubestellar.io>
Contributor
Author
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Non-outreach agents are held at ACMM L3–L5; the Hive will automatically remove the |
Member
|
Superseded by #750, which consolidates this and 14 other test-only coverage PRs into a single reviewable change (commit cherry-picked unmodified, authorship and DCO preserved). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Improvement
tests/static-assets.test.mjsasserted six static-asset contracts — existence,non-emptiness, exact-case naming, path traversal, and
<CNCFProjectCard logo>resolution — but never exercised the branches that report a violation. At
main@b54cf81the file measured 89.06% lines / 85.71% regions, and everyuncovered region was a detection path:
describe(), and the missing,not-a-file, zero-byte, case-mismatch, traversal and broken-logo push sites.
Its only guard against going vacuous was
REFERENCES.size > 20. That catches ascan that finds nothing; it does not catch a
stripUrls()/staticReferences()change that keeps finding references while quietly dropping the broken ones, or
a checker whose comparison stops flagging them. The suite would stay green and
the site would ship a broken image.
This PR:
tests/tools/static-references.mjs— the scan plus the five checkers,parameterised by root, moved verbatim so behaviour is unchanged;
tests/static-assets.test.mjsto assert the same six contractsthrough that module against the real repository, with identical assertions
and identical failure messages;
tests/static-references.test.mjs: 17 cases driving each checkeragainst fixture trees that really do contain a missing, not-a-file,
zero-byte, case-mismatched (leaf and intermediate directory), escaping and
unresolvable-logo reference — plus the negative cases (remote URL, bare
top-level directory, exact-case match) that prove the checkers do not
over-report.
No production code is touched.
Evidence
tests/static-assets.test.mjstests/static-references.test.mjstests/tools/static-references.mjsTZ=UTC node --test— 1197 pass, 0 fail, 2 todo.TZ=UTC node tests/tools/coverage-report.mjs --check 97 --check-source 99— exit 0.Related Issue
Closes #734
— hive: agent=quality backend=copilot model=claude-opus-5 copilot=1.0.88