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

Function TestFindExactMatch

apps/cli/internal/cli/get_test.go:408–428  ·  view source on GitHub ↗

--- Unit tests for helper functions ---

(t *testing.T)

Source from the content-addressed store, hash-verified

406// --- Unit tests for helper functions ---
407
408func TestFindExactMatch(t *testing.T) {
409 tasks := []*model.Task{
410 {ID: "001", Title: "Setup project"},
411 {ID: "002", Title: "Auth service"},
412 }
413
414 // Match by ID
415 if task := findExactMatch("001", tasks); task == nil || task.ID != "001" {
416 t.Error("Expected to find task 001 by ID")
417 }
418
419 // Match by title (case-insensitive)
420 if task := findExactMatch("auth service", tasks); task == nil || task.ID != "002" {
421 t.Error("Expected to find task 002 by title")
422 }
423
424 // No match
425 if task := findExactMatch("nonexistent", tasks); task != nil {
426 t.Error("Expected nil for non-matching query")
427 }
428}
429
430func TestCalculateSimilarity(t *testing.T) {
431 tests := []struct {

Callers

nothing calls this directly

Calls 2

findExactMatchFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected