Files
query-orchestration/test/unit/internal/env/getfatal_test.go
T
2024-12-19 18:49:22 +00:00

26 lines
396 B
Go

package env_test
import (
"gotemplate/internal/env"
"os"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetFatal(t *testing.T) {
name := "test_get_env_var_does_not_exist"
value := "value"
os.Setenv(name, value)
returnValue := env.GetFatal(name)
assert.Equal(t, value, returnValue)
value = ""
os.Setenv(name, value)
assert.Panics(t, func() { env.GetFatal(name) })
}