test: cover the docusaurus.config.js and sidebars.js navigation contract (tests/site-config.test.mjs) - #275
Open
kubestellar-hive[bot] wants to merge 1 commit into
Open
kubestellar-hive[bot] wants to merge 1 commit into
kubestellar-hive[bot] wants to merge 1 commit into
Conversation
No test imported docusaurus.config.js or sidebars.js, so neither file appeared in the coverage report at all. The site's navbar routes, sidebar wiring, asset references and preview-URL construction were verified only by a full docusaurus build. tests/site-config.test.mjs imports the real config (via a createRequire shim, since the ESM config calls require.resolve for its plugin list) and asserts that every internal navbar link resolves to a doc, the blog or a static file; that heading fragments exist in their target doc; that every docSidebar item names a sidebar and every sidebar is reachable; that autogenerated sidebars point at populated docs directories; that branding assets exist on disk; that onBrokenLinks stays 'throw'; that no two docs claim the same route; and that SITE_URL/BASE_URL overrides flow correctly into the JSON-LD logo URL. Both files now report 100% lines and all-files line coverage rises from 73.51% to 90.26%. Signed-off-by: kubestellar-hive[bot] <kubestellar-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 |
This was referenced Sep 18, 2026
Open
[quality] docs/ and blog/ MDX component imports and CNCFProjectCard props have no unit coverage
#297
Open
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
Adds
tests/site-config.test.mjs(15 tests), the first test to importdocusaurus.config.jsandsidebars.js. Before this, neither file appeared in the coverage report at all — not at 0%, but never loaded by any test process.The site's navigation and branding contract lives entirely in those two files and was verified only by a full
docusaurus build, which fails late and prints a wall of build errors rather than a named assertion.What is asserted
to:maps to a real doc route, the blog, or a static file. Route derivation mirrors the docs plugin underrouteBasePath: '/'— an explicit frontmatterslugwins, otherwise the path relative todocs/withindexcollapsing onto its directory./community/end-user-community#projects-born-at-end-user-organizationsis checked against the headings actually present in that doc.docSidebarnavbar item names a sidebar defined insidebars.js, and every sidebar is reachable from the navbar. A rename on either side currently fails silently.docs/.favicon,navbar.logo.src/srcDark,themeConfig.image, bothheadTagslink hrefs, andtheme.customCss.onBrokenLinksstays'throw'. The config carries the comment "Preserve broken-link enforcement; do not weaken." Nothing enforced it until now.SITE_URL/BASE_URLoverrides flow intourl,baseUrland the JSON-LD logo URL, including the trailing-slash strip. This path only runs for GitHub Pages previews, so it is exercised least often exactly where a mistake is hardest to spot.Implementation note
docusaurus.config.jsis ESM but callsrequire.resolve()for its plugin list, which Docusaurus supplies through its own loader. The test installs acreateRequireshim before importing. That is the one non-obvious part of the file.Verification
docusaurus.config.jsandsidebars.jsgo from absent-from-report to 100% lines; all-files line coverage rises 73.51% → 90.26%.docusaurus.config.jseach fail at least one new test: bogus navbar route,onBrokenLinksweakened to'warn', unknownsidebarId, missing logo asset, dead heading fragment, and removing the trailing-slash strip. The config was restored clean afterwards (git diffempty).npx prettier --checkclean.Deliberately out of scope
The
editUrlvalues pointing atcastrojo/endusersare being corrected in #245. Asserting the post-fix value here would make this test red onmain, soeditUrlis not asserted.Disjointness
Touches exactly one new file,
tests/site-config.test.mjs, and no production code. No other open PR touchesdocusaurus.config.js,sidebars.js, or site navigation. It does not modifytests/helpers.mjs(claimed by #231) and adds no JSX import path (claimed by #229), so it does not overlap the component-test or fixture-sandbox work.Related Issue
Closes #274 — merging this lands the only deliverable that issue describes, so nothing is left for it to track.
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-5