MCPcopy Index your code
hub / github.com/coder/coder / TestSubscribeBulkPathsAndDedupes

Function TestSubscribeBulkPathsAndDedupes

agent/agentgit/agentgit_test.go:64–82  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

62}
63
64func 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
84func TestSubscribeNonGitPathsIgnored(t *testing.T) {
85 t.Parallel()

Callers

nothing calls this directly

Calls 3

SubscribeMethod · 0.95
NewHandlerFunction · 0.92
initTestRepoFunction · 0.85

Tested by

no test coverage detected