Repository navigation
Description
This issue addresses specific presentation layer testing improvements and cleanup tasks identified during Epic #154 work. The focus is on practical improvements to test organization, code coverage, and following established testing conventions to prepare the codebase for future development.
Goals
Primary Goals
- Split test_support.rs into multiple focused modules
- Clean unused code in test support modules (unused public functions/methods)
- Fix test output - ensure clean output when run without
--nocapture - Reorganize tests in
src/presentation/views/core.rs(better grouping of integration tests) - Review naming conventions - ensure all tests follow
it_should_format from project conventions - Increase code coverage across presentation layer modules
Success Criteria
- test_support.rs split into logical modules with clear responsibilities
- No unused public methods in test support modules
- Clean test output without
--nocaptureflag - Well-organized test groups in core.rs following project conventions
- All tests use
it_should_naming pattern consistently - Improved code coverage metrics across presentation layer
Implementation Plan
Task 1: Split test_support.rs into Multiple Modules
Current State: Single large file src/presentation/views/test_support.rs (438 lines)
Target Structure:
src/presentation/views/test_support/
├── mod.rs # Module exports and documentation
├── test_writer.rs # TestWriter implementation
├── test_user_output.rs # TestUserOutput struct and basic methods
└── test_wrapper.rs # TestOutputWrapper and convenience methods
Task 2: Clean Unused Code in test_support modules
Current Issues: Unused public functions and methods identified:
output_pair()method marked with#[allow(dead_code)]clear()method marked with#[allow(dead_code)]- Potentially other unused convenience methods
Task 3: Fix Test Output Quality
Problem: Tests produce noisy output when run without --nocapture
Expected Behavior: Clean output following docs/contributing/testing/unit-testing.md
Task 4: Reorganize Tests in core.rs
Current State: Tests in src/presentation/views/core.rs need better organization
Target: Group related tests into logical modules following project conventions
Task 5: Review and Fix Test Naming Conventions
Current Issues: Not all tests follow it_should_ naming pattern
Target: Convert all tests to use it_should_{expected_behavior}_when_{condition} format
Task 6: Increase Code Coverage
Current State: Various gaps in test coverage across presentation layer
Focus: Add missing test cases for edge conditions and ensure comprehensive coverage
Timeline
Estimated Effort: 3-5 days focused development
Task Priority:
- Task 1 (Module Split) - Foundation for other work
- Task 2 (Clean Unused Code) - Remove technical debt
- Task 5 (Naming Conventions) - Align with standards
- Task 4 (Test Organization) - Improve maintainability
- Task 3 (Test Output) - Developer experience
- Task 6 (Code Coverage) - Comprehensive validation
Related Documentation
- Epic #154 - Presentation Layer Reorganization
- Testing Conventions
- Module Organization
- Development Principles
Definition of Done
All 6 tasks completed with comprehensive test coverage, clean organization, and adherence to project conventions.
Activity
docs: [#170] add presentation layer testing and cleanup issue specifi…
refactor: [#170] split test_support.rs into focused testing modules
refactor: [#170] remove unused methods from TestUserOutput
refactor: [#170] remove unused methods from TestOutputWrapper
refactor: [#170] remove into_reentrant_test_wrapper method to decoupl…
refactor: [#170] eliminate TestOutputWrapper duplication
docs: [#170] update progress - mark Task 1 (module split) as completed
docs: [#170] update progress - mark Task 3 (clean test output) as com…
refactor: [#170] remove misleading type_safe_dispatch_prevents_channe…
refactor: [#170] remove redundant user_output_uses_typed_wrappers_int…
feat: [#170] add unit tests for message channel routing
test: [#170] add comprehensive unit tests for message type properties
refactor: [#170] extract BlankLineMessage to dedicated module
test: [#170] remove messy AI-generated tests from UserOutput core module
refactor: [#170] rename core module to user_output module
chore: [#170] clean AI code
refactor: [#170] improve JSON formatter test maintainability and read…
test: [#170] update composite sink tests to follow unit testing conve…
test: [#170] update channel, theme, and verbosity tests to follow uni…
test: [#170] add comprehensive unit tests for UserOutput.write() method
docs: [#170] update issue spec with UserOutput.write() test completio…