(t *testing.T)
| 62 | } |
| 63 | |
| 64 | func TestSubscribeBulkPathsAndDedupes(t *testing.T) { |
| 65 | t.Parallel() |
| 66 | |
| 67 | repoDir := initTestRepo(t) |
| 68 | logger := slogtest.Make(t, nil) |
| 69 | |
| 70 | h := agentgit.NewHandler(logger) |
| 71 | |
| 72 | // Subscribe with multiple paths in the same repo — should dedupe |
| 73 | // to one repo root. |
| 74 | filePath1 := filepath.Join(repoDir, "a.go") |
| 75 | filePath2 := filepath.Join(repoDir, "b.go") |
| 76 | added := h.Subscribe([]string{filePath1, filePath2}) |
| 77 | require.True(t, added, "first subscribe should add a repo") |
| 78 | |
| 79 | // Subscribing again with the same paths should not add new repos. |
| 80 | added = h.Subscribe([]string{filePath1}) |
| 81 | require.False(t, added, "duplicate subscribe should not add repos") |
| 82 | } |
| 83 | |
| 84 | func TestSubscribeNonGitPathsIgnored(t *testing.T) { |
| 85 | t.Parallel() |
nothing calls this directly
no test coverage detected