26 lines
530 B
Go
26 lines
530 B
Go
package gonexapp
|
|
|
|
import "testing"
|
|
|
|
func TestTopMenuAdminRequired(t *testing.T) {
|
|
tests := []struct {
|
|
env string
|
|
defAdmin bool
|
|
want string
|
|
}{
|
|
{"", true, "1"},
|
|
{"", false, "0"},
|
|
{"1", true, "1"},
|
|
{"0", true, "0"},
|
|
{" 1 ", true, "1"},
|
|
{"yes", true, "1"},
|
|
{"yes", false, "0"},
|
|
{"2", true, "1"},
|
|
}
|
|
for _, tc := range tests {
|
|
if got := TopMenuAdminRequired(tc.env, tc.defAdmin); got != tc.want {
|
|
t.Errorf("TopMenuAdminRequired(%q, %v) = %q, want %q", tc.env, tc.defAdmin, got, tc.want)
|
|
}
|
|
}
|
|
}
|