writeDailyNoteAt fabricates a daily note file for a past date, in the same YYYYMM/YYYYMMDD.md layout DailyNoteStore uses. Synthetic content only.
(t *testing.T, dir string, date time.Time, bullets ...string)
| 13 | // writeDailyNoteAt fabricates a daily note file for a past date, in the same |
| 14 | // YYYYMM/YYYYMMDD.md layout DailyNoteStore uses. Synthetic content only. |
| 15 | func writeDailyNoteAt(t *testing.T, dir string, date time.Time, bullets ...string) { |
| 16 | t.Helper() |
| 17 | monthDir := filepath.Join(dir, date.Format("200601")) |
| 18 | if err := os.MkdirAll(monthDir, 0o750); err != nil { |
| 19 | t.Fatal(err) |
| 20 | } |
| 21 | var sb strings.Builder |
| 22 | sb.WriteString("## 10:00\n\n") |
| 23 | for _, b := range bullets { |
| 24 | sb.WriteString("- " + b + "\n") |
| 25 | } |
| 26 | if err := os.WriteFile(filepath.Join(monthDir, date.Format("20060102")+".md"), []byte(sb.String()), 0o600); err != nil { |
| 27 | t.Fatal(err) |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | func TestRollup_WeeklyAndMonthlyDeterministic(t *testing.T) { |
| 32 | dir := t.TempDir() |
no test coverage detected