MCPcopy Create free account
hub / github.com/cli/cli / TestNewCmdDevelop

Function TestNewCmdDevelop

pkg/cmd/issue/develop/develop_test.go:25–187  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func TestNewCmdDevelop(t *testing.T) {
26 // Test shared parsing of issue number / URL.
27 argparsetest.TestArgParsing(t, NewCmdDevelop)
28
29 absWorktree, err := filepath.Abs("work trees/issue-1")
30 require.NoError(t, err)
31
32 tests := []struct {
33 name string
34 input string
35 output DevelopOptions
36 expectedBaseRepo ghrepo.Interface
37 wantStdout string
38 wantStderr string
39 wantErr bool
40 errMsg string
41 }{
42 {
43 name: "branch-repo flag",
44 input: "1 --branch-repo owner/repo",
45 output: DevelopOptions{
46 IssueNumber: 1,
47 BranchRepo: "owner/repo",
48 },
49 },
50 {
51 name: "base flag",
52 input: "1 --base feature",
53 output: DevelopOptions{
54 IssueNumber: 1,
55 BaseBranch: "feature",
56 },
57 },
58 {
59 name: "checkout flag",
60 input: "1 --checkout",
61 output: DevelopOptions{
62 IssueNumber: 1,
63 Checkout: true,
64 },
65 },
66 {
67 name: "worktree flag",
68 input: `1 --checkout --worktree "work trees/issue-1"`,
69 output: DevelopOptions{
70 IssueNumber: 1,
71 Checkout: true,
72 Worktree: absWorktree,
73 },
74 },
75 {
76 name: "list flag",
77 input: "1 --list",
78 output: DevelopOptions{
79 IssueNumber: 1,
80 List: true,
81 },
82 },

Callers

nothing calls this directly

Calls 8

TestArgParsingFunction · 0.92
TestFunction · 0.92
IsSameFunction · 0.92
NewCmdDevelopFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65
StringMethod · 0.65
BaseRepoMethod · 0.65

Tested by

no test coverage detected