(t *testing.T)
| 73 | } |
| 74 | |
| 75 | func TestJournalWriteAndReadWithContent(t *testing.T) { |
| 76 | uid := uniqueID() |
| 77 | content := "Overwrite test " + uid |
| 78 | date := "2099-07-04" |
| 79 | |
| 80 | // First write |
| 81 | _, stderr, code := hey(t, "journal", "write", date, "-c", "original content "+uid, "--json") |
| 82 | if code != 0 { |
| 83 | t.Fatalf("journal write failed (exit %d): %s", code, stderr) |
| 84 | } |
| 85 | |
| 86 | // Overwrite |
| 87 | _, stderr, code = hey(t, "journal", "write", date, "-c", content, "--json") |
| 88 | if code != 0 { |
| 89 | t.Fatalf("journal write (overwrite) failed (exit %d): %s", code, stderr) |
| 90 | } |
| 91 | |
| 92 | // Read and verify overwrite took effect |
| 93 | resp := heyJSON(t, "journal", "read", date) |
| 94 | raw := string(resp.Data) |
| 95 | assertContains(t, raw, "Overwrite test") |
| 96 | |
| 97 | // Cross-verify: the browser should show the overwritten content, not the original. |
| 98 | html := fetchHTML(t, baseURL+"/calendar/days/"+date+"/journal_entry/edit") |
| 99 | assertContains(t, html, "Overwrite test") |
| 100 | assertNotContains(t, html, "original content") |
| 101 | } |
nothing calls this directly
no test coverage detected