Skip to content

Conversation

@mudcube
Copy link
Contributor

@mudcube mudcube commented Nov 11, 2025

No description provided.

Refactored api-parser.test.ts to improve code quality and reduce
duplication by using shared test fixtures instead of creating
temporary files for each test.

Changes:
- Added beforeAll() to create all 12 test fixtures once
- Removed per-test createTempFile() calls and try/finally blocks
- Added afterAll() for single cleanup operation
- Reduced code duplication and improved maintainability

All 12 tests pass with identical behavior and assertions.
Tests remain isolated (read-only access to shared fixtures).
Streamlined test suite by removing redundant and trivial tests,
consolidating similar tests with parameterization.

Changes:
- collapse.test.ts: 31→28 tests (-3, consolidated with it.each)
- katex.test.ts: 25→25 tests (consolidated 13 into 2 parameterized)
- file-io.test.ts: 31→28 tests (-3 trivial empty tests)
- markdown.test.ts: 38→35 tests (-3 trivial empty tests)

Results:
- Removed 9 trivial/duplicate tests (373→364 total)
- Reduced ~270 lines of redundant code
- Improved test maintainability with parameterized tests
- All 364 tests passing

Test quality improvements:
- Used it.each() for formula variations in katex
- Consolidated HTML escaping tests (covered in sanitize.test.ts)
- Removed self-evident empty→empty tests
Added 119 new tests for previously untested modules to improve
coverage and confidence.

New test files:
- api-docs.test.ts: 59 tests (markdown generation for all API types)
- tabs.test.ts: 29 tests (tab parsing, HTML generation, edge cases)
- toc.test.ts: 31 tests (TOC generation, nesting, ID conversion)

Coverage improvements:
- api-docs.ts: 0% → 100%
- tabs.ts: 0% → 100%
- toc.ts: 0% → 100%

Test suite growth:
- Test files: 21 → 24 (+3 files)
- Total tests: 364 → 483 (+119 tests, +33%)
- All tests passing

New tests cover:
- All API item types (functions, classes, interfaces, enums, types)
- Type linking and escaping
- Metadata badges (@deprecated, @SInCE, @experimental)
- Tab parsing and base64 encoding
- TOC marker detection and nested list generation
- Comprehensive edge cases and error handling
@mudcube mudcube merged commit c02531e into main Nov 11, 2025
1 of 3 checks passed
@mudcube mudcube deleted the claude/systematic-test-fixing-011CV1o3tRE567FxxGWrbNXZ branch December 16, 2025 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants