✅ Test config
This commit is contained in:
parent
2b888f203d
commit
e441e541c7
5 changed files with 101 additions and 0 deletions
26
config/config_test.go
Normal file
26
config/config_test.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEnvDefaultsToDev(t *testing.T) {
|
||||
c := Config{}
|
||||
assert.Equal(t, DEV, c.Environment())
|
||||
}
|
||||
|
||||
func TestInvalidEnvReturnsDev(t *testing.T) {
|
||||
c := Config{Env: Env("foobar")}
|
||||
assert.Equal(t, DEV, c.Environment())
|
||||
}
|
||||
|
||||
func TestValidEnvReturnsCorrect(t *testing.T) {
|
||||
for _, e := range Envs {
|
||||
t.Run(string(e), func(t *testing.T) {
|
||||
c := Config{Env: e}
|
||||
assert.Equal(t, e, c.Environment())
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue