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

Function runSeen

internal/cmd/seen_test.go:47–69  ·  view source on GitHub ↗
(t *testing.T, server *httptest.Server, args ...string)

Source from the content-addressed store, hash-verified

45}
46
47func runSeen(t *testing.T, server *httptest.Server, args ...string) (output.Response, error) {
48 t.Helper()
49 t.Setenv("HEY_TOKEN", "test-token")
50 t.Setenv("HEY_NO_KEYRING", "1")
51 t.Setenv("HEY_BASE_URL", "")
52 tmpDir := t.TempDir()
53 t.Setenv("XDG_CONFIG_HOME", tmpDir)
54 t.Setenv("XDG_STATE_HOME", tmpDir)
55 t.Setenv("XDG_CACHE_HOME", tmpDir)
56
57 root := newRootCmd()
58 var buf bytes.Buffer
59 root.SetOut(&buf)
60 root.SetErr(&buf)
61 root.SetArgs(append([]string{"seen", "--json", "--base-url", server.URL}, args...))
62
63 err := root.Execute()
64 var resp output.Response
65 if buf.Len() > 0 {
66 _ = json.Unmarshal(buf.Bytes(), &resp)
67 }
68 return resp, err
69}
70
71func runUnseen(t *testing.T, server *httptest.Server, args ...string) (output.Response, error) {
72 t.Helper()

Callers 4

TestSeenSingleFunction · 0.85
TestSeenMultipleFunction · 0.85
TestSeenNoArgsFunction · 0.85
TestSeenInvalidIDFunction · 0.85

Calls 1

newRootCmdFunction · 0.85

Tested by

no test coverage detected