|
| 1 | +package cmd |
| 2 | + |
| 3 | +import ( |
| 4 | + "reflect" |
| 5 | + "testing" |
| 6 | + |
| 7 | + "github.com/spf13/cobra" |
| 8 | +) |
| 9 | + |
| 10 | +func TestNewClientBuildsCmd(t *testing.T) { |
| 11 | + tests := []struct { |
| 12 | + name string |
| 13 | + want *ClientBuildsCmd |
| 14 | + }{ |
| 15 | + { |
| 16 | + name: "test new client builds command", |
| 17 | + want: &ClientBuildsCmd{}, |
| 18 | + }, |
| 19 | + } |
| 20 | + for _, tc := range tests { |
| 21 | + t.Run(tc.name, func(t *testing.T) { |
| 22 | + if got := NewClientBuildsCmd(); !reflect.DeepEqual(got, tc.want) { |
| 23 | + t.Errorf("NewClientBuildsCmd() = %v, want %v", got, tc.want) |
| 24 | + } |
| 25 | + }) |
| 26 | + } |
| 27 | +} |
| 28 | + |
| 29 | +func TestClientBuildsCmd_GetClientBuildsCmd(t *testing.T) { |
| 30 | + tests := []struct { |
| 31 | + name string |
| 32 | + cbc *ClientBuildsCmd |
| 33 | + want *cobra.Command |
| 34 | + }{ |
| 35 | + { |
| 36 | + name: "test get client builds command", |
| 37 | + cbc: &ClientBuildsCmd{}, |
| 38 | + want: &cobra.Command{ |
| 39 | + Use: "clientbuilds", |
| 40 | + Short: "get clientbuilds for a mobile client", |
| 41 | + RunE: func(cmd *cobra.Command, args []string) error { |
| 42 | + return nil |
| 43 | + }, |
| 44 | + }, |
| 45 | + }, |
| 46 | + } |
| 47 | + for _, tc := range tests { |
| 48 | + t.Run(tc.name, func(t *testing.T) { |
| 49 | + got := tc.cbc.GetClientBuildsCmd() |
| 50 | + if use := got.Use; !reflect.DeepEqual(use, tc.want.Use) { |
| 51 | + t.Errorf("ClientBuildsCmd.GetClientBuildsCmd().Use = %v, want %v", use, tc.want.Use) |
| 52 | + } |
| 53 | + if short := got.Short; !reflect.DeepEqual(short, tc.want.Short) { |
| 54 | + t.Errorf("ClientBuildsCmd.GetClientBuildsCmd().Short = %v, want %v", short, tc.want.Short) |
| 55 | + } |
| 56 | + if runE := got.RunE; !reflect.DeepEqual(reflect.TypeOf(runE), reflect.TypeOf(tc.want.RunE)) { |
| 57 | + t.Errorf("ClientBuildsCmd.GetClientBuildsCmd().RunE = %v, want %v", reflect.TypeOf(runE), reflect.TypeOf(tc.want.RunE)) |
| 58 | + } |
| 59 | + if runE := got.RunE; !reflect.DeepEqual(runE(nil, nil), tc.want.RunE(nil, nil)) { |
| 60 | + t.Errorf("ClientBuildsCmd.GetClientBuildsCmd().RunE = %v, want %v", runE(nil, nil), tc.want.RunE(nil, nil)) |
| 61 | + } |
| 62 | + }) |
| 63 | + } |
| 64 | +} |
| 65 | + |
| 66 | +func TestClientBuildsCmd_ListClientBuildsCmd(t *testing.T) { |
| 67 | + tests := []struct { |
| 68 | + name string |
| 69 | + cbc *ClientBuildsCmd |
| 70 | + want *cobra.Command |
| 71 | + }{ |
| 72 | + { |
| 73 | + name: "test list client builds command", |
| 74 | + cbc: &ClientBuildsCmd{}, |
| 75 | + want: &cobra.Command{ |
| 76 | + Use: "clientbuild", |
| 77 | + Short: "get a specific clientbuild for a mobile client", |
| 78 | + RunE: func(cmd *cobra.Command, args []string) error { |
| 79 | + return nil |
| 80 | + }, |
| 81 | + }, |
| 82 | + }, |
| 83 | + } |
| 84 | + for _, tc := range tests { |
| 85 | + t.Run(tc.name, func(t *testing.T) { |
| 86 | + got := tc.cbc.ListClientBuildsCmd() |
| 87 | + if use := got.Use; !reflect.DeepEqual(use, tc.want.Use) { |
| 88 | + t.Errorf("ClientBuildsCmd.ListClientBuildsCmd().Use = %v, want %v", use, tc.want.Use) |
| 89 | + } |
| 90 | + if short := got.Short; !reflect.DeepEqual(short, tc.want.Short) { |
| 91 | + t.Errorf("ClientBuildsCmd.ListClientBuildsCmd().Short = %v, want %v", short, tc.want.Short) |
| 92 | + } |
| 93 | + if runE := got.RunE; !reflect.DeepEqual(reflect.TypeOf(runE), reflect.TypeOf(tc.want.RunE)) { |
| 94 | + t.Errorf("ClientBuildsCmd.ListClientBuildsCmd().RunE = %v, want %v", reflect.TypeOf(runE), reflect.TypeOf(tc.want.RunE)) |
| 95 | + } |
| 96 | + if runE := got.RunE; !reflect.DeepEqual(runE(nil, nil), tc.want.RunE(nil, nil)) { |
| 97 | + t.Errorf("ClientBuildsCmd.ListClientBuildsCmd().RunE = %v, want %v", runE(nil, nil), tc.want.RunE(nil, nil)) |
| 98 | + } |
| 99 | + }) |
| 100 | + } |
| 101 | +} |
| 102 | + |
| 103 | +func TestClientBuildsCmd_CreateClientBuildsCmd(t *testing.T) { |
| 104 | + tests := []struct { |
| 105 | + name string |
| 106 | + cbc *ClientBuildsCmd |
| 107 | + want *cobra.Command |
| 108 | + }{ |
| 109 | + { |
| 110 | + name: "test create client builds command", |
| 111 | + cbc: &ClientBuildsCmd{}, |
| 112 | + want: &cobra.Command{ |
| 113 | + Use: "clientbuild", |
| 114 | + Short: "create a build for a mobile client", |
| 115 | + RunE: func(cmd *cobra.Command, args []string) error { |
| 116 | + return nil |
| 117 | + }, |
| 118 | + }, |
| 119 | + }, |
| 120 | + } |
| 121 | + for _, tc := range tests { |
| 122 | + t.Run(tc.name, func(t *testing.T) { |
| 123 | + got := tc.cbc.CreateClientBuildsCmd() |
| 124 | + if use := got.Use; !reflect.DeepEqual(use, tc.want.Use) { |
| 125 | + t.Errorf("ClientBuildsCmd.CreateClientBuildsCmd().Use = %v, want %v", use, tc.want.Use) |
| 126 | + } |
| 127 | + if short := got.Short; !reflect.DeepEqual(short, tc.want.Short) { |
| 128 | + t.Errorf("ClientBuildsCmd.CreateClientBuildsCmd().Short = %v, want %v", short, tc.want.Short) |
| 129 | + } |
| 130 | + if runE := got.RunE; !reflect.DeepEqual(reflect.TypeOf(runE), reflect.TypeOf(tc.want.RunE)) { |
| 131 | + t.Errorf("ClientBuildsCmd.CreateClientBuildsCmd().RunE = %v, want %v", reflect.TypeOf(runE), reflect.TypeOf(tc.want.RunE)) |
| 132 | + } |
| 133 | + if runE := got.RunE; !reflect.DeepEqual(runE(nil, nil), tc.want.RunE(nil, nil)) { |
| 134 | + t.Errorf("ClientBuildsCmd.CreateClientBuildsCmd().RunE = %v, want %v", runE(nil, nil), tc.want.RunE(nil, nil)) |
| 135 | + } |
| 136 | + }) |
| 137 | + } |
| 138 | +} |
| 139 | + |
| 140 | +func TestClientBuildsCmd_DeleteClientBuildsCmd(t *testing.T) { |
| 141 | + tests := []struct { |
| 142 | + name string |
| 143 | + cbc *ClientBuildsCmd |
| 144 | + want *cobra.Command |
| 145 | + }{ |
| 146 | + { |
| 147 | + name: "test create client builds command", |
| 148 | + cbc: &ClientBuildsCmd{}, |
| 149 | + want: &cobra.Command{ |
| 150 | + Use: "clientbuild", |
| 151 | + Short: "delete a build for a mobile client", |
| 152 | + RunE: func(cmd *cobra.Command, args []string) error { |
| 153 | + return nil |
| 154 | + }, |
| 155 | + }, |
| 156 | + }, |
| 157 | + } |
| 158 | + for _, tc := range tests { |
| 159 | + t.Run(tc.name, func(t *testing.T) { |
| 160 | + //cbc := &ClientBuildsCmd{} |
| 161 | + got := tc.cbc.DeleteClientBuildsCmd() |
| 162 | + if use := got.Use; !reflect.DeepEqual(use, tc.want.Use) { |
| 163 | + t.Errorf("ClientBuildsCmd.DeleteClientBuildsCmd().Use = %v, want %v", use, tc.want.Use) |
| 164 | + } |
| 165 | + if short := got.Short; !reflect.DeepEqual(short, tc.want.Short) { |
| 166 | + t.Errorf("ClientBuildsCmd.DeleteClientBuildsCmd().Short = %v, want %v", short, tc.want.Short) |
| 167 | + } |
| 168 | + if runE := got.RunE; !reflect.DeepEqual(reflect.TypeOf(runE), reflect.TypeOf(tc.want.RunE)) { |
| 169 | + t.Errorf("ClientBuildsCmd.DeleteClientBuildsCmd().RunE = %v, want %v", reflect.TypeOf(runE), reflect.TypeOf(tc.want.RunE)) |
| 170 | + } |
| 171 | + if runE := got.RunE; !reflect.DeepEqual(runE(nil, nil), tc.want.RunE(nil, nil)) { |
| 172 | + t.Errorf("ClientBuildsCmd.DeleteClientBuildsCmd().RunE = %v, want %v", runE(nil, nil), tc.want.RunE(nil, nil)) |
| 173 | + } |
| 174 | + }) |
| 175 | + } |
| 176 | +} |
| 177 | + |
| 178 | +func TestClientBuildsCmd_StopClientBuildsCmd(t *testing.T) { |
| 179 | + tests := []struct { |
| 180 | + name string |
| 181 | + cbc *ClientBuildsCmd |
| 182 | + want *cobra.Command |
| 183 | + }{ |
| 184 | + { |
| 185 | + name: "test create client builds command", |
| 186 | + cbc: &ClientBuildsCmd{}, |
| 187 | + want: &cobra.Command{ |
| 188 | + Use: "clientbuild", |
| 189 | + Short: "stop a build for a mobile client", |
| 190 | + RunE: func(cmd *cobra.Command, args []string) error { |
| 191 | + return nil |
| 192 | + }, |
| 193 | + }, |
| 194 | + }, |
| 195 | + } |
| 196 | + for _, tc := range tests { |
| 197 | + t.Run(tc.name, func(t *testing.T) { |
| 198 | + got := tc.cbc.StopClientBuildsCmd() |
| 199 | + if use := got.Use; !reflect.DeepEqual(use, tc.want.Use) { |
| 200 | + t.Errorf("ClientBuildsCmd.StopClientBuildsCmd().Use = %v, want %v", use, tc.want.Use) |
| 201 | + } |
| 202 | + if short := got.Short; !reflect.DeepEqual(short, tc.want.Short) { |
| 203 | + t.Errorf("ClientBuildsCmd.StopClientBuildsCmd().Short = %v, want %v", short, tc.want.Short) |
| 204 | + } |
| 205 | + if runE := got.RunE; !reflect.DeepEqual(reflect.TypeOf(runE), reflect.TypeOf(tc.want.RunE)) { |
| 206 | + t.Errorf("ClientBuildsCmd.StopClientBuildsCmd().RunE = %v, want %v", reflect.TypeOf(runE), reflect.TypeOf(tc.want.RunE)) |
| 207 | + } |
| 208 | + if runE := got.RunE; !reflect.DeepEqual(runE(nil, nil), tc.want.RunE(nil, nil)) { |
| 209 | + t.Errorf("ClientBuildsCmd.StopClientBuildsCmd().RunE = %v, want %v", runE(nil, nil), tc.want.RunE(nil, nil)) |
| 210 | + } |
| 211 | + }) |
| 212 | + } |
| 213 | +} |
| 214 | + |
| 215 | +func TestClientBuildsCmd_StartClientBuildsCmd(t *testing.T) { |
| 216 | + tests := []struct { |
| 217 | + name string |
| 218 | + cbc *ClientBuildsCmd |
| 219 | + want *cobra.Command |
| 220 | + }{ |
| 221 | + { |
| 222 | + name: "test create client builds command", |
| 223 | + cbc: &ClientBuildsCmd{}, |
| 224 | + want: &cobra.Command{ |
| 225 | + Use: "clientbuild", |
| 226 | + Short: "start a build for a mobile client", |
| 227 | + RunE: func(cmd *cobra.Command, args []string) error { |
| 228 | + return nil |
| 229 | + }, |
| 230 | + }, |
| 231 | + }, |
| 232 | + } |
| 233 | + for _, tc := range tests { |
| 234 | + t.Run(tc.name, func(t *testing.T) { |
| 235 | + //cbc := &ClientBuildsCmd{} |
| 236 | + got := tc.cbc.StartClientBuildsCmd() |
| 237 | + if use := got.Use; !reflect.DeepEqual(use, tc.want.Use) { |
| 238 | + t.Errorf("ClientBuildsCmd.StartClientBuildsCmd().Use = %v, want %v", use, tc.want.Use) |
| 239 | + } |
| 240 | + if short := got.Short; !reflect.DeepEqual(short, tc.want.Short) { |
| 241 | + t.Errorf("ClientBuildsCmd.StartClientBuildsCmd().Short = %v, want %v", short, tc.want.Short) |
| 242 | + } |
| 243 | + if runE := got.RunE; !reflect.DeepEqual(reflect.TypeOf(runE), reflect.TypeOf(tc.want.RunE)) { |
| 244 | + t.Errorf("ClientBuildsCmd.StartClientBuildsCmd().RunE = %v, want %v", reflect.TypeOf(runE), reflect.TypeOf(tc.want.RunE)) |
| 245 | + } |
| 246 | + if runE := got.RunE; !reflect.DeepEqual(runE(nil, nil), tc.want.RunE(nil, nil)) { |
| 247 | + t.Errorf("ClientBuildsCmd.StartClientBuildsCmd().RunE = %v, want %v", runE(nil, nil), tc.want.RunE(nil, nil)) |
| 248 | + } |
| 249 | + }) |
| 250 | + } |
| 251 | +} |
0 commit comments