Skip to content

[quality] docusaurus.config.js and sidebars.js navigation contract has zero unit coverage #274

Description

@hivecommons-hive

Finding

No test in tests/ imports docusaurus.config.js or sidebars.js. Both files are absent from the coverage report entirely — not at 0%, but never loaded by any test process at all.

Unit evidence: node --test --experimental-test-coverage (node v26.8.2), run locally at rev 00b44df: 6 test files, 55 tests, all files 73.51% lines / 47.12% branch. Neither docusaurus.config.js nor sidebars.js appears in the table.

End-to-end evidence: the repository has no end-to-end or browser suite, so end-to-end coverage for these files is unobtainable, not demonstrably absent. That reporting gap is tracked separately in #186 and is not re-litigated here.

The site's entire navigation and branding contract lives in these two files and is verified only by a full docusaurus build, which runs late and reports a wall of build errors rather than a named failing assertion. Specifically unverified today:

  • 9 navbar items. to: routes (/, /members/, /awards/, /metrics/, /events/, /blog, and a fragment link into /community/end-user-community) are never resolved against docs/. type: 'docSidebar' items name architecturesSidebar and communitySidebar with no check that sidebars.js defines them — a rename on either side is silent.
  • Asset references. favicon, navbar.logo.src, navbar.logo.srcDark, themeConfig.image, and the two headTags link hrefs (/manifest.json, /favicons/apple-touch-icon.png) are never checked against static/. src/css/custom.css likewise.
  • onBrokenLinks: 'throw'. The config carries the comment "Preserve broken-link enforcement; do not weaken." Nothing enforces that comment.
  • The SITE_URL / BASE_URL override path (lines 9-10) and the JSON-LD logo URL built from them (line 63, including the trailing-slash strip) never execute under test. This path exists for GitHub Pages previews, so it is exercised least often in exactly the configuration where a mistake is hardest to notice.
  • Route collisions. Four docs carry an explicit frontmatter slug (/, /members, /awards, /resources) alongside path-derived routes for the rest. Nothing detects two docs claiming the same route.
  • Sidebar targets. autogenerated entries name dirName: 'architectures' and dirName: 'community'; nothing checks those directories exist or contain documents.

Recommendation

Add tests/site-config.test.mjs, importing the real config and asserting the contract above. docusaurus.config.js is ESM but calls require.resolve() for its plugin list (Docusaurus supplies that through its own loader), so the test needs a createRequire shim before importing — this is the one non-obvious part.

Route derivation should mirror the docs plugin under routeBasePath: '/': an explicit frontmatter slug wins, otherwise the path relative to docs/ is used with index collapsing onto its directory.

Deliberately out of scope: the editUrl values currently pointing at castrojo/endusers. That is being corrected in #245, and asserting the post-fix value here would make this test red on main.

Verification

A test built to this shape passes 15/15, raises docusaurus.config.js and sidebars.js to 100% lines, and lifts all-files line coverage from 73.51% to 90.26%. Six independent mutations of docusaurus.config.js — bogus navbar route, onBrokenLinks weakened to 'warn', unknown sidebarId, missing logo asset, dead heading fragment, removed trailing-slash strip — each fail at least one assertion, so the tests are load-bearing rather than tautological.

Scope

One file, one PR: tests/site-config.test.mjs. This is disjoint from every open quality PR — none touches docusaurus.config.js, sidebars.js, or site navigation. It does not modify tests/helpers.mjs (occupied by #231) and adds no JSX import path (occupied by #229).

Priority

  • Impact: medium — navigation and branding regressions currently surface only as a failed production build
  • Effort: low — one new test file, no dependencies, no production code change

— hive: agent=quality backend=copilot model=claude-opus-5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/qualityApproved by a Hive merger/owner for auto-merge on green CIhive/hosted-available-lke648397-260827-5n31Approved by a Hive merger/owner for auto-merge on green CIqualityApproved by a Hive merger/owner for auto-merge on green CItestingApproved by a Hive merger/owner for auto-merge on green CI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions