feat: implement gas and delivery admin systems
This commit is contained in:
26
backend/api/internal/logic/gas/menu_test.go
Normal file
26
backend/api/internal/logic/gas/menu_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user