Skip to content

test: add unit tests for McpDocsServer and formatPageContent#25

Merged
scalvert merged 1 commit into
mainfrom
sc/add-runtime-tests
Apr 12, 2026
Merged

test: add unit tests for McpDocsServer and formatPageContent#25
scalvert merged 1 commit into
mainfrom
sc/add-runtime-tests

Conversation

@scalvert

Copy link
Copy Markdown
Owner

Summary

  • Add tests/server-test.ts with 6 tests covering McpDocsServer: constructor (data-based and file-based configs), initialize() success and idempotency, getStatus() with correct values, default version, and pre-init state
  • Add tests/docs-fetch-test.ts with 6 tests covering formatPageContent: null doc, full doc with all fields, empty description, empty headings, heading level filtering (>3 excluded from TOC), TOC indentation

Test plan

  • npm test passes (64 tests total, 12 new)
  • New tests cover both happy and error paths for runtime code

Closes #19

🤖 Generated with Claude Code

@scalvert
scalvert force-pushed the sc/add-runtime-tests branch from a593959 to c1b1cd9 Compare April 12, 2026 20:13
@scalvert
scalvert force-pushed the sc/infra-sdk-coverage-contributing branch from 2a1734b to eabddea Compare April 12, 2026 20:13
@scalvert
scalvert force-pushed the sc/add-runtime-tests branch from c1b1cd9 to d728461 Compare April 12, 2026 20:18
@scalvert
scalvert force-pushed the sc/infra-sdk-coverage-contributing branch from eabddea to 572fdb9 Compare April 12, 2026 20:18
@scalvert
scalvert force-pushed the sc/add-runtime-tests branch from d728461 to b611983 Compare April 12, 2026 20:22
@scalvert
scalvert force-pushed the sc/infra-sdk-coverage-contributing branch 2 times, most recently from 083a7a2 to c749eb9 Compare April 12, 2026 20:24
Base automatically changed from sc/infra-sdk-coverage-contributing to main April 12, 2026 20:24
- Add tests/server-test.ts with 6 tests covering McpDocsServer:
  constructor (data-based and file-based configs), initialize()
  success and idempotency, getStatus() with correct values,
  default version, and pre-init state
- Add tests/docs-fetch-test.ts with 6 tests covering formatPageContent:
  null doc, full doc with all fields, empty description, empty headings,
  heading level filtering (>3 excluded from TOC), TOC indentation

Closes #19

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@scalvert
scalvert force-pushed the sc/add-runtime-tests branch from b611983 to 1f9189e Compare April 12, 2026 20:24
@scalvert
scalvert merged commit 3c284f2 into main Apr 12, 2026
8 checks passed
@scalvert
scalvert deleted the sc/add-runtime-tests branch April 12, 2026 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add unit tests for runtime code

1 participant