Overview
Follow-up to #197 (Phase 1 unit tests). These tests address gaps discovered during Phase 1 implementation and focus on integration points and edge cases that can still run headless in CI.
Target: v3000.0.x
New Test Suites
1. Notification/Observer Integration Tests
Test that components respond correctly to preference changes (not just that preferences persist):
- testRendererRespondsToStyleChange // MPRenderer updates when theme changes
- testHighlighterRespondsToFontChange // Editor re-highlights on font change
- testPreferenceChangeCoalescence // Rapid changes don't cause thrashing
- testThemeChangeNotification // Verify observers receive theme changes
- testFontSizeChangeNotification // Font changes propagate correctly
Approach:
- Register mock observers for NSNotificationCenter
- Trigger preference changes
- Verify callbacks fire with correct data
- Test that dependent components update state
2. MPDocument Lifecycle Tests
Test document state management beyond basic I/O:
- testDocumentDirtyFlagAfterEdit
- testDocumentRevertToSaved
- testDocumentEncodingDetection // Auto-detect UTF-8 vs Latin-1
- testDocumentWithNoExtension
- testSaveWithFileConflict // File modified externally
- testOpenFileDeletedDuringEdit // File removed while open
Approach:
- Create MPDocument instances programmatically
- Manipulate document state
- Verify flags and behaviors
3. Renderer Edge Cases
Additional renderer scenarios discovered during Phase 1:
- testRendererWithNilDataSource
- testRendererWithEmptyMarkdown
- testRendererExtensionCombinations // Tables + footnotes + strikethrough
- testRendererWithMalformedHTMLInCodeBlocks
- testRenderCancellation
- testConcurrentRenderRequests
4. HGMarkdownHighlighter Coverage Gaps
The highlighter has 75% coverage but some paths are untested:
- testHighlighterWithLargeDocument // Performance/stress test
- testHighlighterStyleParsingErrors // Error callback (0% covered)
- testHighlighterTextViewDidChange // 0% covered currently
- testHighlighterScrollHandler // Partial coverage
5. Image Handling in Exports
- testExportWithEmbeddedImages // Base64 images render correctly
- testExportWithLinkedImages // External image URLs preserved
- testInvalidImageURLs // Graceful handling of broken images
Out of Scope (Requires GUI)
- PDF export (needs print subsystem)
- Clipboard operations (needs pasteboard)
- Live preview synchronization (needs WebView display)
- Autosave (tightly coupled to AppKit)
Success Criteria
Priority
- High: Notification/observer tests - this is where integration bugs hide
- Medium: Document lifecycle tests
- Medium: Renderer edge cases
- Lower: Highlighter gaps (already decent coverage)
Related
Overview
Follow-up to #197 (Phase 1 unit tests). These tests address gaps discovered during Phase 1 implementation and focus on integration points and edge cases that can still run headless in CI.
Target: v3000.0.x
New Test Suites
1. Notification/Observer Integration Tests
Test that components respond correctly to preference changes (not just that preferences persist):
Approach:
2. MPDocument Lifecycle Tests
Test document state management beyond basic I/O:
Approach:
3. Renderer Edge Cases
Additional renderer scenarios discovered during Phase 1:
- testRendererWithNilDataSource - testRendererWithEmptyMarkdown - testRendererExtensionCombinations // Tables + footnotes + strikethrough - testRendererWithMalformedHTMLInCodeBlocks - testRenderCancellation - testConcurrentRenderRequests4. HGMarkdownHighlighter Coverage Gaps
The highlighter has 75% coverage but some paths are untested:
5. Image Handling in Exports
Out of Scope (Requires GUI)
Success Criteria
Priority
Related
plans/xcuitest.md- Full technical design