combluotion/config/config_test.go

27 lines
484 B
Go
Raw Normal View History

2024-09-13 13:38:30 -05:00
package config
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestEnvDefaultsToDev(t *testing.T) {
c := Config{}
assert.Equal(t, Dev, c.Environment())
2024-09-13 13:38:30 -05:00
}
func TestInvalidEnvReturnsDev(t *testing.T) {
c := Config{Env: Env("foobar")}
assert.Equal(t, Dev, c.Environment())
2024-09-13 13:38:30 -05:00
}
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())
})
}
}