feat: implement gas and delivery admin systems

This commit is contained in:
david
2026-07-30 14:16:58 +08:00
parent 1093385f95
commit f5ecc0d973
252 changed files with 49385 additions and 363 deletions

View 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)
}
}
}