MCPcopy Create free account
hub / github.com/basecamp/hey-cli / TestJournalWriteAndReadWithContent

Function TestJournalWriteAndReadWithContent

tests/smoke/journal_test.go:75–101  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73}
74
75func 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}

Callers

nothing calls this directly

Calls 6

uniqueIDFunction · 0.85
heyFunction · 0.85
heyJSONFunction · 0.85
assertContainsFunction · 0.85
fetchHTMLFunction · 0.85
assertNotContainsFunction · 0.85

Tested by

no test coverage detected