(t *testing.T)
| 73 | } |
| 74 | |
| 75 | func TestScanDirectory(t *testing.T) { |
| 76 | tmpDir := t.TempDir() |
| 77 | |
| 78 | file1 := filepath.Join(tmpDir, "main.go") |
| 79 | require.NoError(t, os.WriteFile(file1, []byte("package main\n"), 0644)) |
| 80 | |
| 81 | jsonData, err := ScanDirectory(tmpDir, 3, "Test instructions", []string{}) |
| 82 | require.NoError(t, err) |
| 83 | |
| 84 | var result []any |
| 85 | err = json.Unmarshal(jsonData, &result) |
| 86 | require.NoError(t, err) |
| 87 | assert.Len(t, result, 3) |
| 88 | |
| 89 | instr := result[2].(map[string]any) |
| 90 | assert.Equal(t, "Test instructions", instr["details"]) |
| 91 | } |
| 92 | |
| 93 | // TestScanDirectory_SkipsSymlinks checks that ScanDirectory does not follow a |
| 94 | // symlink to a file outside the project. |
nothing calls this directly
no test coverage detected