MCPcopy Create free account
hub / github.com/driangle/taskmd / TestFuzzyMatchTasks

Function TestFuzzyMatchTasks

apps/cli/internal/cli/get_test.go:683–704  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

681}
682
683func TestFuzzyMatchTasks(t *testing.T) {
684 tasks := []*model.Task{
685 {ID: "001", Title: "Setup project"},
686 {ID: "002", Title: "Implement authentication"},
687 {ID: "003", Title: "Build UI components"},
688 }
689
690 // "auth" should match task 002 via substring
691 matches := fuzzyMatchTasks("auth", tasks, 0.6)
692 if len(matches) == 0 {
693 t.Fatal("Expected at least one fuzzy match for 'auth'")
694 }
695 if matches[0].Task.ID != "002" {
696 t.Errorf("Expected top match to be task 002, got %s", matches[0].Task.ID)
697 }
698
699 // Very high threshold should filter everything
700 matches = fuzzyMatchTasks("auth", tasks, 0.99)
701 if len(matches) != 0 {
702 t.Errorf("Expected no matches with threshold 0.99, got %d", len(matches))
703 }
704}
705
706func createParentTestFiles(t *testing.T) string {
707 t.Helper()

Callers

nothing calls this directly

Calls 1

fuzzyMatchTasksFunction · 0.85

Tested by

no test coverage detected