MCPcopy Index your code
hub / github.com/DoNewsCode/core / TestModule_ProvideCommand_verifyCmd

Function TestModule_ProvideCommand_verifyCmd

config/module_test.go:124–168  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

122}
123
124func TestModule_ProvideCommand_verifyCmd(t *testing.T) {
125 rootCmd := setup()
126 cases := []struct {
127 name string
128 args []string
129 isErr bool
130 }{
131 {
132 "bad config",
133 []string{"config", "verify", "--targetFile", "./testdata/module_test_empty.yaml"},
134 true,
135 },
136 {
137 "bad config with module",
138 []string{"config", "verify", "foo", "--targetFile", "./testdata/module_test_empty.yaml"},
139 true,
140 },
141 {
142 "bad config with good module selected",
143 []string{"config", "verify", "baz", "--targetFile", "./testdata/module_test_empty.yaml"},
144 false,
145 },
146 {
147 "good config",
148 []string{"config", "verify", "--targetFile", "./testdata/module_test_gold.yaml"},
149 false,
150 },
151 {
152 "good config with module",
153 []string{"config", "verify", "foo", "--targetFile", "./testdata/module_test_gold.yaml"},
154 false,
155 },
156 }
157 for _, c := range cases {
158 t.Run(c.name, func(t *testing.T) {
159 rootCmd.SetArgs(c.args)
160 err := rootCmd.Execute()
161 if c.isErr {
162 assert.Error(t, err)
163 } else {
164 assert.NoError(t, err)
165 }
166 })
167 }
168}
169
170func TestModule_Watch(t *testing.T) {
171 t.Run("test without module", func(t *testing.T) {

Callers

nothing calls this directly

Calls 3

setupFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected