(t *testing.T)
| 387 | } |
| 388 | |
| 389 | func TestScanRateLimiting(t *testing.T) { |
| 390 | t.Parallel() |
| 391 | |
| 392 | repoDir := initTestRepo(t) |
| 393 | logger := slogtest.Make(t, nil) |
| 394 | |
| 395 | h := agentgit.NewHandler(logger) |
| 396 | |
| 397 | h.Subscribe([]string{filepath.Join(repoDir, "file.go")}) |
| 398 | |
| 399 | // First scan should succeed. |
| 400 | ctx := context.Background() |
| 401 | msg1 := h.Scan(ctx) |
| 402 | // Even if no dirty files, the first scan always runs. |
| 403 | // The important thing is it doesn't panic. |
| 404 | _ = msg1 |
| 405 | |
| 406 | // Create a dirty file so the next scan has something to report. |
| 407 | require.NoError(t, os.WriteFile(filepath.Join(repoDir, "new.go"), []byte("package x\n"), 0o600)) |
| 408 | |
| 409 | msg2 := h.Scan(ctx) |
| 410 | require.NotNil(t, msg2, "scan with new dirty file should return changes") |
| 411 | } |
| 412 | |
| 413 | func TestSubscribeDeeplyNestedFile(t *testing.T) { |
| 414 | t.Parallel() |
nothing calls this directly
no test coverage detected