24 lines
621 B
Go
24 lines
621 B
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestEnabledEnvRequiresExplicitTrue(t *testing.T) {
|
|
for _, testCase := range []struct {
|
|
name string
|
|
value string
|
|
want bool
|
|
}{
|
|
{name: "unset", want: false},
|
|
{name: "false", value: "false", want: false},
|
|
{name: "other value", value: "TRUE", want: false},
|
|
{name: "true", value: "true", want: true},
|
|
} {
|
|
t.Run(testCase.name, func(t *testing.T) {
|
|
t.Setenv("GATEWAY_CALLBACK_BATCH_ENABLED", testCase.value)
|
|
if got := enabledEnv("GATEWAY_CALLBACK_BATCH_ENABLED"); got != testCase.want {
|
|
t.Fatalf("enabledEnv() = %v, want %v", got, testCase.want)
|
|
}
|
|
})
|
|
}
|
|
}
|