(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestAppendToFile_AppendsData(t *testing.T) { |
| 12 | f := filepath.Join(t.TempDir(), "summary.json") |
| 13 | require.NoError(t, os.WriteFile(f, []byte("line1\n"), 0644)) |
| 14 | |
| 15 | err := appendToFile(f, []byte("line2\n")) |
| 16 | require.NoError(t, err) |
| 17 | |
| 18 | got, err := os.ReadFile(f) |
| 19 | require.NoError(t, err) |
| 20 | require.Equal(t, "line1\nline2\n", string(got)) |
| 21 | } |
| 22 | |
| 23 | func TestAppendToFileFallback_ExistingFile(t *testing.T) { |
| 24 | f := filepath.Join(t.TempDir(), "summary.json") |
nothing calls this directly
no test coverage detected