Skip to content

Commit

Permalink
config: add unknown key test
Browse files Browse the repository at this point in the history
  • Loading branch information
andydunstall committed Jul 14, 2024
1 parent 715b186 commit 1c2ecaa
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/config/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ sub:
assert.Equal(t, 5, conf.Sub.Car)
})

t.Run("unknown key", func(t *testing.T) {
f, err := os.CreateTemp("", "piko")
assert.NoError(t, err)

_, err = f.WriteString(`unknown: xyz`)
assert.NoError(t, err)

var conf fakeConfig

assert.Error(t, Load(&conf, f.Name(), false))
})

t.Run("invalid yaml", func(t *testing.T) {
f, err := os.CreateTemp("", "piko")
assert.NoError(t, err)
Expand Down

0 comments on commit 1c2ecaa

Please sign in to comment.