From 5c9487875a5724d2c80f20124241ca8c12685fd0 Mon Sep 17 00:00:00 2001 From: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Thu, 19 Nov 2026 07:46:51 -0500 Subject: [PATCH] test: cover sidebars.ts and sidebarsAnalyses.ts exported config Both files are imported by docusaurus.config.ts but no unit test ever imported either one, so c8's default (non --all) test:coverage report silently omitted them instead of scoring them. Add a direct unit test per file asserting the exported sidebar shape, so a regression to the autogenerated docSidebar/analysesSidebar config fails fast in the unit suite rather than only surfacing in a full Docusaurus build. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- lib/sidebars.test.mts | 18 ++++++++++++++++++ lib/sidebarsAnalyses.test.mts | 19 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 lib/sidebars.test.mts create mode 100644 lib/sidebarsAnalyses.test.mts diff --git a/lib/sidebars.test.mts b/lib/sidebars.test.mts new file mode 100644 index 00000000..1ea2cfd4 --- /dev/null +++ b/lib/sidebars.test.mts @@ -0,0 +1,18 @@ +import assert from 'node:assert/strict'; +import { describe, it } from 'node:test'; +import sidebars from '../sidebars.ts'; + +// sidebars.ts is imported by docusaurus.config.ts and so is exercised by the +// e2e link-rewrite build (e2e/linkRewrite.test.mjs), but it has no unit +// coverage: c8's default (non --all) report simply omits any file that no +// unit test ever imports, so this module is invisible to the 100% +// unit-coverage gate rather than counting against it. Import it directly so +// a regression to the autogenerated docSidebar shape fails fast in the unit +// suite, without waiting on a full Docusaurus build. +describe('sidebars', () => { + it('exports a docSidebar generated from the docs folder structure', () => { + assert.deepEqual(sidebars, { + docSidebar: [{ type: 'autogenerated', dirName: '.' }], + }); + }); +}); diff --git a/lib/sidebarsAnalyses.test.mts b/lib/sidebarsAnalyses.test.mts new file mode 100644 index 00000000..7b09b0e4 --- /dev/null +++ b/lib/sidebarsAnalyses.test.mts @@ -0,0 +1,19 @@ +import assert from 'node:assert/strict'; +import { describe, it } from 'node:test'; +import sidebars from '../sidebarsAnalyses.ts'; + +// sidebarsAnalyses.ts is imported by docusaurus.config.ts's analyses plugin +// and so is exercised by the e2e link-rewrite build +// (e2e/linkRewrite.test.mjs), but it has no unit coverage: c8's default +// (non --all) report simply omits any file that no unit test ever imports, +// so this module is invisible to the 100% unit-coverage gate rather than +// counting against it. Import it directly so a regression to the +// autogenerated analysesSidebar shape fails fast in the unit suite, without +// waiting on a full Docusaurus build. +describe('sidebarsAnalyses', () => { + it('exports an analysesSidebar generated from the analyses folder structure', () => { + assert.deepEqual(sidebars, { + analysesSidebar: [{ type: 'autogenerated', dirName: '.' }], + }); + }); +});