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

Function runUnseen

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

Source from the content-addressed store, hash-verified

69}
70
71func runUnseen(t *testing.T, server *httptest.Server, args ...string) (output.Response, error) {
72 t.Helper()
73 t.Setenv("HEY_TOKEN", "test-token")
74 t.Setenv("HEY_NO_KEYRING", "1")
75 t.Setenv("HEY_BASE_URL", "")
76 tmpDir := t.TempDir()
77 t.Setenv("XDG_CONFIG_HOME", tmpDir)
78 t.Setenv("XDG_STATE_HOME", tmpDir)
79 t.Setenv("XDG_CACHE_HOME", tmpDir)
80
81 root := newRootCmd()
82 var buf bytes.Buffer
83 root.SetOut(&buf)
84 root.SetErr(&buf)
85 root.SetArgs(append([]string{"unseen", "--json", "--base-url", server.URL}, args...))
86
87 err := root.Execute()
88 var resp output.Response
89 if buf.Len() > 0 {
90 _ = json.Unmarshal(buf.Bytes(), &resp)
91 }
92 return resp, err
93}
94
95func TestSeenSingle(t *testing.T) {
96 server := seenServer(t)

Callers 4

TestUnseenSingleFunction · 0.85
TestUnseenMultipleFunction · 0.85
TestUnseenNoArgsFunction · 0.85
TestUnseenInvalidIDFunction · 0.85

Calls 1

newRootCmdFunction · 0.85

Tested by

no test coverage detected