(t *testing.T)
| 15 | ) |
| 16 | |
| 17 | func 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 | |
| 40 | func eksGoReactSampleModules() projectconfig.Modules { |
| 41 | parameters := projectconfig.Parameters{"a": "b"} |
nothing calls this directly
no test coverage detected