MCPcopy
hub / github.com/databus23/helm-diff / TestLocalCmdArgValidation

Function TestLocalCmdArgValidation

cmd/local_test.go:10–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestLocalCmdArgValidation(t *testing.T) {
11 cases := []struct {
12 name string
13 args []string
14 expectError bool
15 }{
16 {
17 name: "no arguments",
18 args: []string{},
19 expectError: true,
20 },
21 {
22 name: "one argument",
23 args: []string{"chart1"},
24 expectError: true,
25 },
26 {
27 name: "three arguments",
28 args: []string{"chart1", "chart2", "chart3"},
29 expectError: true,
30 },
31 }
32
33 for _, tc := range cases {
34 t.Run(tc.name, func(t *testing.T) {
35 cmd := localCmd()
36 cmd.SetArgs(tc.args)
37 err := cmd.Execute()
38
39 if tc.expectError && err == nil {
40 t.Errorf("Expected error but got none")
41 }
42 if !tc.expectError && err != nil {
43 t.Errorf("Expected no error but got: %v", err)
44 }
45 })
46 }
47}
48
49func TestLocalCmdExecution(t *testing.T) {
50 manifestYAML := `---

Callers

nothing calls this directly

Calls 1

localCmdFunction · 0.85

Tested by

no test coverage detected