Add integration test suite for end-to-end workflows
Overview
While unit tests cover individual modules, we need integration tests for complete user workflows.
Workflows to Test
1. Note Creation from Visual Selection
Workflow: Select text → :ZkNewFromTitle → Pick template → Note created
- Test: Complete workflow with telescope picker
- Test: Complete workflow with fzf picker
- Test: Complete workflow with vim.ui.select
- Test: Handles template variable expansion
- Test: Creates note in correct location
- Test: Opens new note in buffer
Workflow: Select text → :ZkNewFromContent → Pick template → Enter title → Note created
- Test: Complete workflow
- Test: Selected text becomes note content
- Test: Template variables expanded
- Test: Note created with proper frontmatter
2. Snippet Insertion
Workflow: :ZkSnippet → Pick snippet → Snippet inserted with expansion
- Test: Variables expanded correctly
- Test: Inserted at cursor position
- Test: Multiple snippets in same buffer
- Test: Undo works correctly
3. Note Deletion
Workflow: :ZkDelete → Confirm → Note trashed → Buffer closed
- Test: Trash workflow
- Test: Hard delete workflow
- Test: Unsaved changes handled
- Test: Multiple buffers with same file
Workflow: :ZkDeletePick → Pick note → Confirm → Note deleted
- Test: Complete workflow
- Test: Closes correct buffer
- Test: Handles current buffer deletion
4. Template Selection
Workflow: :ZkPickTemplate → Pick template → Enter title → Note created
- Test: Complete workflow
- Test: Template applied correctly
- Test: Variables expanded
5. Presentation Mode
Workflow: :ZkPresent → slides opens
- Test: Saves if needed
- Test: Opens in terminal
- Test: Handles missing slides command
6. Update Index
Workflow: :ZkUpdate → Index updated → Output shown
- Test: Complete workflow
- Test: Quickfix populated
- Test: Notifications shown
7. Quick Filters
Workflow: :ZkOrphans → List shown → Select note → Opens
- Test: :ZkOrphans
- Test: :ZkRecents
- Test: :ZkPinned
- Test: :ZkHub
- Test: :ZkLast
Multi-Step Integration Tests
- Create note → Insert snippet → Delete note
- Create note from selection → Edit → Present as slides
- Delete pick → Undo not possible (verify)
- Multiple template creations in session
Configuration Integration Tests
- Test with all commands enabled
- Test with selective commands disabled
- Test with deprecated command names
- Test with custom picker configurations
- Test with custom template variables
Error Recovery Tests
- Picker cancelled mid-workflow
- Template file deleted during selection
- Disk full during note creation
- Permission denied scenarios
- Network filesystem issues
Test File Location
tests/zk-extras/integration_spec.lua
Priority
High - Integration tests ensure the plugin works as users expect
Notes
- May require test notebook setup
- Consider using mock zk notebook
- May need to mock external commands
- Test data should be self-contained