Skip to content

test: unit-test the page-discovery helper in scripts/html-pages.mjs - #179

Merged
hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-html-pages-helper
Oct 11, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
mainfrom
quality/test-html-pages-helper

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Test Improvement

Adds scripts/html-pages.test.mjs, a direct unit test for scripts/html-pages.mjs — the page-discovery helper that ten static gates import to decide which pages they inspect — and documents it in README ## Checks (required by ci-wiring.test.mjs).

  • htmlFiles() on a temp tree: recursion, sorted output, .html-only, skips exactly SKIP_DIRS (any depth, directories only), [] on empty tree
  • SKIP_DIRS pinned to the tooling set; never a content directory
  • isRedirectPage() positive spellings (quotes, case, = whitespace, attribute order, multi-line) and negatives (CSP / content-type http-equiv, name="refresh", prose)
  • lineOf() 1-based semantics
  • live-tree pins: index.html, 404.html, stories/index.html and every make-redirects.sh MAP page are discovered; nothing under a skipped dir is; redirect pages == MAP paths

Mutation-verified: adding "stories" to SKIP_DIRS, dropping the recursion, or loosening the refresh regex each fails 1–4 of the new cases while the existing 537 stay green. Full suite: 548/548, check-links.sh, check-redirects.test.sh, check-links.test.sh all pass. Runs through the existing node --test scripts/*.test.mjs step — no workflow change.

Closes #178


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

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

htmlFiles(), isRedirectPage(), lineOf() and SKIP_DIRS decide which pages
every static gate inspects, but nothing tested them directly: an over-broad
SKIP_DIRS or a walker that stopped recursing would leave every gate green
while it ran over fewer pages. Pin the walker on a throw-away tree, the
redirect matcher on every attribute spelling, and the live tree against
make-redirects.sh's MAP so the page set can never silently shrink.

Closes #178

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: quality <quality@hive.kubestellar.io>
@kubestellar-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

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

@hivecommons-hive
hivecommons-hive Bot merged commit c849eae into main Oct 11, 2026
6 of 7 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the quality/test-html-pages-helper branch October 11, 2026 20:21
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.

[quality] scripts/html-pages.mjs page-discovery helper has no direct unit test — gates can pass vacuously

0 participants