MCPcopy Create free account
hub / github.com/DoNewsCode/core / setup

Function setup

config/module_test.go:19–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17)
18
19func setup() *cobra.Command {
20 config, _ := NewConfig()
21 mod := Module{
22 conf: config,
23 exportedConfigs: []ExportedConfig{
24 {
25 "foo",
26 map[string]interface{}{
27 "foo": "bar",
28 },
29 "A mock config",
30 func(data map[string]interface{}) error {
31 if _, ok := data["foo"]; !ok {
32 return errors.New("bad config")
33 }
34 return nil
35 },
36 },
37 {
38 "baz",
39 map[string]interface{}{
40 "baz": "qux",
41 },
42 "Other mock config",
43 nil,
44 },
45 },
46 dispatcher: nil,
47 }
48 rootCmd := &cobra.Command{
49 Use: "root",
50 }
51 mod.ProvideCommand(rootCmd)
52 return rootCmd
53}
54
55func tearDown() {
56 os.Remove("./testdata/module_test.yaml")

Calls 2

ProvideCommandMethod · 0.95
NewConfigFunction · 0.85

Tested by

no test coverage detected