Skip to content

Commit 53cd36d

Browse files
super3claude
andcommitted
Consolidate test files while maintaining 100% coverage
- Reduced from 5 test files (900+ lines) to 3 focused files (854 lines) - mdtail.test.js: Core functionality and unit tests (290 lines) - mdtail.integration.test.js: Full flow and integration tests (317 lines) - mdtail.edge.test.js: Edge cases and branch coverage (247 lines) - Maintained 100% code coverage with 62 passing tests - Improved test organization and reduced duplication 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9e906d2 commit 53cd36d

7 files changed

Lines changed: 434 additions & 486 deletions

File tree

TODO.md

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,41 @@
1-
# mdtail.dev
1+
## Code Refactoring
22

3-
A simple terminal app that displays and live-refreshes markdown files.
3+
### Test Consolidation (Maintain 100% Coverage)
4+
- [x] Merge 5 test files (900+ lines) into 3 focused files
5+
- [x] `mdtail.test.js` - Core functionality and unit tests (290 lines)
6+
- [x] `mdtail.integration.test.js` - Full flow and integration tests (317 lines)
7+
- [x] `mdtail.edge.test.js` - Edge cases and branch coverage scenarios (247 lines)
8+
- [x] Remove redundant tests while maintaining 100% coverage
9+
- [x] Consolidate mock setup and teardown logic
410

5-
## Current Features
6-
- [x] Display markdown files in terminal
7-
- [x] Live refresh when file changes
8-
- [x] Clear screen on updates
9-
- [x] Formatted output with borders
10-
- [x] Graceful exit with Ctrl+C
11-
- [x] Full terminal width borders
12-
- [x] Hidden cursor for cleaner display
13-
- [x] Support for multiple markdown files with tabs
14-
- [x] Arrow key navigation between tabs (← →)
15-
- [x] Global CLI installation with npm link
16-
- [x] Wildcard support (*.md)
17-
- [x] Help system (--help)
18-
- [x] Default to TODO.md when no files specified
11+
### Extract Display Logic (~80-100 lines)
12+
- [ ] Create `lib/display.js` module with Display class
13+
- [ ] Move `formatContent()`, `renderTabs()`, `showNavigation()` methods
14+
- [ ] Consolidate console.log calls into single `render()` method
15+
- [ ] Extract ANSI escape codes to constants (HIDE_CURSOR, SHOW_CURSOR, etc.)
1916

20-
## Testing & Quality
21-
- [x] Comprehensive test suite with Jest
22-
- [x] 100% code coverage (statements, branches, functions, lines)
23-
- [x] 61 unit tests covering all functionality
24-
- [x] Modular architecture (lib/mdtail.js)
25-
- [x] GitHub Actions CI/CD pipeline
26-
- [x] Automated testing on push and PRs
27-
- [x] Coverage reporting with Coveralls integration
17+
### Separate File Management (~90-110 lines)
18+
- [ ] Create `lib/fileManager.js` module with FileManager class
19+
- [ ] Move `expandFiles()`, `validateFiles()`, `startWatching()`, `stopWatching()`
20+
- [ ] Implement better file validation with custom error messages
21+
- [ ] Replace `fs.watchFile` with `fs.watch` or chokidar for better performance
2822

29-
## Code Refactoring
30-
- [ ] Test consolidation - Merge 5 test files into 2-3 focused files
31-
- [ ] Extract display logic into separate Display class
32-
- [ ] Separate file management into FileManager class
33-
- [ ] Create configuration object for settings
34-
- [ ] Convert to ES6 modules (import/export)
35-
- [ ] Use async/await for file operations
36-
- [ ] Replace fs.watchFile with fs.watch or chokidar
37-
- [ ] Simplify display with single render() method
38-
- [ ] Extract ANSI codes to constants
39-
- [ ] Add custom error classes
40-
- [ ] Add chalk for terminal colors
41-
- [ ] Consider blessed/ink for richer TUI
42-
- [ ] Add commander for robust CLI parsing
23+
### Modern JavaScript
24+
- [ ] Convert from CommonJS to ES6 modules (import/export)
25+
- [ ] Use async/await for all file operations instead of sync methods
26+
- [ ] Use template literals for multi-line string formatting
27+
- [ ] Add proper TypeScript definitions
28+
29+
### Improved Error Handling
30+
- [ ] Create custom error classes (FileNotFoundError, InvalidMarkdownError)
31+
- [ ] Implement graceful degradation for missing terminal features
32+
- [ ] Better error messages with suggestions for fixes
33+
34+
### Enhanced CLI & Display
35+
- [ ] Add chalk library for colored output
36+
- [ ] Consider blessed or ink for richer TUI with mouse support
37+
- [ ] Add commander.js for robust CLI argument parsing
38+
- [ ] Support for themes and color customization
4339

4440
## Next Steps
4541
- [ ] Publish to npm registry

test/index.test.js

Lines changed: 0 additions & 103 deletions
This file was deleted.

test/mdtail-coverage.test.js

Lines changed: 0 additions & 120 deletions
This file was deleted.

test/mdtail-edge.test.js

Lines changed: 0 additions & 89 deletions
This file was deleted.

0 commit comments

Comments
 (0)