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

Function TestNewCmdSync

pkg/cmd/repo/sync/sync_test.go:25–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func TestNewCmdSync(t *testing.T) {
26 tests := []struct {
27 name string
28 tty bool
29 input string
30 output SyncOptions
31 wantErr bool
32 errMsg string
33 }{
34 {
35 name: "no argument",
36 tty: true,
37 input: "",
38 output: SyncOptions{},
39 },
40 {
41 name: "destination repo",
42 tty: true,
43 input: "cli/cli",
44 output: SyncOptions{
45 DestArg: "cli/cli",
46 },
47 },
48 {
49 name: "source repo",
50 tty: true,
51 input: "--source cli/cli",
52 output: SyncOptions{
53 SrcArg: "cli/cli",
54 },
55 },
56 {
57 name: "branch",
58 tty: true,
59 input: "--branch trunk",
60 output: SyncOptions{
61 Branch: "trunk",
62 },
63 },
64 {
65 name: "force",
66 tty: true,
67 input: "--force",
68 output: SyncOptions{
69 Force: true,
70 },
71 },
72 }
73 for _, tt := range tests {
74 t.Run(tt.name, func(t *testing.T) {
75 ios, _, _, _ := iostreams.Test()
76 ios.SetStdinTTY(tt.tty)
77 ios.SetStdoutTTY(tt.tty)
78 f := &cmdutil.Factory{
79 IOStreams: ios,
80 }
81 argv, err := shlex.Split(tt.input)
82 assert.NoError(t, err)

Callers

nothing calls this directly

Calls 7

TestFunction · 0.92
NewCmdSyncFunction · 0.85
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected