Commit 8beeedf
test(theme): add vitest + jsdom coverage for ./theme (#81)
* test(theme): add vitest + jsdom coverage for the theme entry point
Adds tests for the previously-untested `./theme` surface:
- createDocsRegistryOptions / createDocsRegistry (registry + CLI command)
- useMcpRegistry hook (undefined without plugin data, registry with it)
- McpInstallButton (renders trigger, lists client commands, dropdown
toggle, renders nothing when unconfigured)
Runs under vitest with a per-file jsdom environment; Docusaurus
build-time-only modules (@theme/Icon/*, @docusaurus/useGlobalData) are
aliased to test stubs. Adds react/react-dom/jsdom/@testing-library as
devDeps (react/react-dom remain optional peers for consumers).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* docs(test): note where the usePluginData contract is actually guarded
Clarify that the stub only fakes runtime behavior; the real signature is
typechecked via McpRegistryContext.tsx's import of '@docusaurus/useGlobalData'
(unaliased under tsc), so API drift fails typecheck via the source.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 1ab51b0 commit 8beeedf
6 files changed
Lines changed: 839 additions & 1 deletion
File tree
- tests
- __stubs__
0 commit comments