(t *testing.T)
| 411 | } |
| 412 | |
| 413 | func TestSubscribeDeeplyNestedFile(t *testing.T) { |
| 414 | t.Parallel() |
| 415 | |
| 416 | repoDir := initTestRepo(t) |
| 417 | logger := slogtest.Make(t, nil) |
| 418 | |
| 419 | // Create a deeply nested directory structure inside the repo. |
| 420 | nestedDir := filepath.Join(repoDir, "a", "b", "c") |
| 421 | require.NoError(t, os.MkdirAll(nestedDir, 0o700)) |
| 422 | nestedFile := filepath.Join(nestedDir, "deep.go") |
| 423 | require.NoError(t, os.WriteFile(nestedFile, []byte("package deep\n"), 0o600)) |
| 424 | |
| 425 | h := agentgit.NewHandler(logger) |
| 426 | |
| 427 | added := h.Subscribe([]string{nestedFile}) |
| 428 | require.True(t, added, "deeply nested file should resolve to repo root") |
| 429 | |
| 430 | msg := h.Scan(context.Background()) |
| 431 | require.NotNil(t, msg) |
| 432 | require.Len(t, msg.Repositories, 1) |
| 433 | require.Equal(t, repoDir, msg.Repositories[0].RepoRoot) |
| 434 | |
| 435 | // The nested file should appear in the unified diff. |
| 436 | require.Contains(t, msg.Repositories[0].UnifiedDiff, "a/b/c/deep.go") |
| 437 | } |
| 438 | |
| 439 | func TestSubscribeNestedGitRepos(t *testing.T) { |
| 440 | t.Parallel() |
nothing calls this directly
no test coverage detected