Files
platforms/backend/api/internal/logic/gas/menu_test.go

27 lines
733 B
Go

package gas
import "testing"
func TestMenusOnlyAllowGasAdmin(t *testing.T) {
if got := MenusForRole("admin"); len(got) == 0 {
t.Fatal("admin must receive gas menus")
}
for _, role := range []string{"root", "delivery", "installer", "operations", ""} {
if got := MenusForRole(role); len(got) != 0 {
t.Fatalf("role %q must not receive gas admin menus", role)
}
}
}
func TestMenuContainsContractAndDeliveryManagement(t *testing.T) {
found := map[string]bool{}
for _, menu := range MenusForRole("admin") {
found[menu.Identity] = true
}
for _, identity := range []string{"delivery_basic", "gasorder_contract", "invitation_qrcode"} {
if !found[identity] {
t.Fatalf("missing confirmed menu %q", identity)
}
}
}