Skip to content

Conversation

@panbanda
Copy link
Owner

Summary

  • Increase test coverage from 77.42% to 86.69% (~10 percentage point improvement)
  • Add 1040 lines of new tests across 10 files
  • All 261 tests pass, clippy clean

Test Coverage Details

Files with new tests:

  • cli/build.rs: Verbose mode tests for HTML and image export
  • cli/validate.rs: Validation stats, human readable output, error display
  • exporter/html.rs: Conditional test skip when frontend not built
  • model/mod.rs: Duplicate detection, error display, invalid path depth
  • model/types.rs: Element trait methods, default type functions, Options
  • parser/parser.rs: Empty version/name validation, context errors
  • parser/resolver.rs: Flow/deployment validation, nested nodes, suggestions
  • parser/writer.rs: Container/component finding and updating
  • server/docs.rs: Navigation, markdown rendering, link rewriting
  • server/hub.rs: Hub::default() implementation

Coverage breakdown:

Module Before After
cli/build.rs 82% 98%
parser/parser.rs 85% 98%
server/hub.rs 93% 100%
model/types.rs 100% 100%
model/mod.rs 99% 99%

Remaining uncovered code:

The remaining ~13% gap to 95% consists primarily of:

  • Runtime server code (cli/serve.rs, server/mod.rs) requiring actual server execution
  • WebSocket handlers requiring integration testing
  • CLI dispatch code parsing command-line arguments
  • Async HTTP handlers in server/docs.rs

These would require integration tests rather than unit tests to cover.

Test plan

  • All 261 tests pass
  • Clippy clean
  • Coverage verified with cargo tarpaulin

Generated with Claude Code

@panbanda
Copy link
Owner Author

@panbanda Ready for review - coverage increased from 77% to 87% with comprehensive unit tests.

Add comprehensive test coverage across multiple modules:

- cli/build.rs: verbose mode tests for HTML and image export
- cli/validate.rs: tests for validation stats, human readable output,
  error display with file/line info
- exporter/html.rs: conditional test skip when frontend not built
- model/mod.rs: tests for duplicate detection in all collection types,
  error display, invalid path depth handling
- model/types.rs: tests for Element trait methods on all C4 types,
  default type functions, Options default
- parser/parser.rs: tests for empty version/name validation,
  container and component without context errors
- parser/resolver.rs: tests for flow validation, deployment validation,
  nested deployment nodes, component parent validation, suggestions
- parser/writer.rs: tests for container/component element finding
  and updating with proper C4 model structure
- server/docs.rs: tests for navigation building, markdown rendering,
  link rewriting, table and code block rendering
- server/hub.rs: test for Hub::default() implementation

Total: 1040 lines of new tests added, coverage increased ~10 points.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@panbanda panbanda force-pushed the test/increase-coverage branch from 47d5635 to eb22bf7 Compare January 11, 2026 17:28
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@panbanda panbanda merged commit 15a6842 into main Jan 11, 2026
5 checks passed
@panbanda panbanda deleted the test/increase-coverage branch January 11, 2026 17:42
@panbanda panbanda restored the test/increase-coverage branch January 12, 2026 03:22
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.

2 participants