--- Unit tests for helper functions ---
(t *testing.T)
| 406 | // --- Unit tests for helper functions --- |
| 407 | |
| 408 | func 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 | |
| 430 | func TestCalculateSimilarity(t *testing.T) { |
| 431 | tests := []struct { |
nothing calls this directly
no test coverage detected