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

Function runJournalRead

internal/cmd/journal_test.go:171–193  ·  view source on GitHub ↗

--- Journal read tests ---

(t *testing.T, server *httptest.Server, args ...string)

Source from the content-addressed store, hash-verified

169// --- Journal read tests ---
170
171func runJournalRead(t *testing.T, server *httptest.Server, args ...string) (output.Response, error) {
172 t.Helper()
173 t.Setenv("HEY_TOKEN", "test-token")
174 t.Setenv("HEY_NO_KEYRING", "1")
175 t.Setenv("HEY_BASE_URL", "")
176 tmpDir := t.TempDir()
177 t.Setenv("XDG_CONFIG_HOME", tmpDir)
178 t.Setenv("XDG_STATE_HOME", tmpDir)
179 t.Setenv("XDG_CACHE_HOME", tmpDir)
180
181 root := newRootCmd()
182 var buf bytes.Buffer
183 root.SetOut(&buf)
184 root.SetErr(&buf)
185 root.SetArgs(append([]string{"journal", "read", "--json", "--base-url", server.URL}, args...))
186
187 err := root.Execute()
188 var resp output.Response
189 if buf.Len() > 0 {
190 _ = json.Unmarshal(buf.Bytes(), &resp)
191 }
192 return resp, err
193}
194
195func TestJournalReadReturns200WithContent(t *testing.T) {
196 server := journalServerWithReadBehavior(t, "200")

Calls 1

newRootCmdFunction · 0.85

Tested by

no test coverage detected