-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Issue
No unit tests exist for critical functions like:
CreateTaskReadTaskFile/WriteTaskFileGetTasksMarkTaskDone- Task YAML parsing/serialization
Problem
- Hard to verify changes don't break existing functionality
- Impossible to test edge cases (invalid YAML, missing files, etc.)
- Refactoring is risky
- No regression detection
Solution
Create task_test.go with tests for:
func TestReadTaskFile(t *testing.T) {
// Test valid task file
// Test missing file
// Test invalid YAML
// Test malformed frontmatter
}
func TestCreateTask(t *testing.T) {
// Test basic creation
// Test duplicate prevention
// Test with GitHub issue
// Test special characters in title
}
func TestGetTasks(t *testing.T) {
// Test empty vault
// Test multiple projects
// Test filtering by project
}Tools
Use Go's built-in testing package + t.TempDir() for isolated tests.
Benefits
- Catch regressions before shipping
- Enable safe refactoring
- Document expected behavior
- Improve code reliability
Impact
🟢 Low - But highly recommended
Metadata
Metadata
Assignees
Labels
No labels