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

Function runTodoAdd

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

Source from the content-addressed store, hash-verified

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

Callers 6

TestTodoAddPositionalFunction · 0.85
TestTodoAddShortFlagFunction · 0.85
TestTodoAddLongFlagFunction · 0.85
TestTodoAddConflictFunction · 0.85
TestTodoAddEmptyFunction · 0.85
TestTodoAddStdinFunction · 0.85

Calls 1

newRootCmdFunction · 0.85

Tested by

no test coverage detected