MCPcopy Index your code
hub / github.com/commitdev/zero / TestLoadConfig

Function TestLoadConfig

internal/config/projectconfig/project_config_test.go:17–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestLoadConfig(t *testing.T) {
18 file, err := ioutil.TempFile(os.TempDir(), "config.yml")
19 if err != nil {
20 log.Fatal(err)
21 }
22 defer os.Remove(file.Name())
23 file.Write([]byte(validConfigContent()))
24 filePath := file.Name()
25
26 want := &projectconfig.ZeroProjectConfig{
27 Name: "abc",
28 ShouldPushRepositories: true,
29 Modules: eksGoReactSampleModules(),
30 }
31
32 t.Run("Should load and unmarshal config correctly", func(t *testing.T) {
33 got := projectconfig.LoadConfig(filePath)
34 if !cmp.Equal(want, got, cmpopts.EquateEmpty()) {
35 t.Errorf("projectconfig.ZeroProjectConfig.Unmarshal mismatch (-want +got):\n%s", cmp.Diff(want, got))
36 }
37 })
38}
39
40func eksGoReactSampleModules() projectconfig.Modules {
41 parameters := projectconfig.Parameters{"a": "b"}

Callers

nothing calls this directly

Calls 3

LoadConfigFunction · 0.92
validConfigContentFunction · 0.85
eksGoReactSampleModulesFunction · 0.85

Tested by

no test coverage detected