fix(menu): show dashboard overview as root item
This commit is contained in:
@@ -8,8 +8,8 @@ func TestPlatformMenusAreStaticTwoDimensionalData(t *testing.T) {
|
||||
}
|
||||
seen := make(map[string]bool)
|
||||
for _, group := range PlatformMenus {
|
||||
if len(group) < 2 {
|
||||
t.Fatal("each platform menu group must include a first-level menu and at least one second-level menu")
|
||||
if len(group) == 0 {
|
||||
t.Fatal("platform menu groups must not be empty")
|
||||
}
|
||||
parent := group[0]
|
||||
if parent.ParentIdentity != "" {
|
||||
@@ -39,3 +39,24 @@ func TestRootLoadsAllStaticPlatformMenus(t *testing.T) {
|
||||
t.Fatalf("root menu count = %d, want %d", len(menus), len(AllPlatformMenus()))
|
||||
}
|
||||
}
|
||||
|
||||
func TestPlatformMenuContainsDashboardRoutes(t *testing.T) {
|
||||
want := map[string]string{
|
||||
"dashboard_overview": "/dashboard/overview",
|
||||
}
|
||||
for _, menu := range AllPlatformMenus() {
|
||||
if path, ok := want[menu.Identity]; ok {
|
||||
if menu.Path != path {
|
||||
t.Fatalf("menu %q path = %q, want %q", menu.Identity, menu.Path, path)
|
||||
}
|
||||
delete(want, menu.Identity)
|
||||
}
|
||||
}
|
||||
if len(want) != 0 {
|
||||
t.Fatalf("missing dashboard menus: %#v", want)
|
||||
}
|
||||
menu, ok := FindPlatformMenu("dashboard_overview")
|
||||
if !ok || menu.ParentIdentity != "" || menu.Icon != "icon-dashboard" {
|
||||
t.Fatalf("dashboard overview must be a first-level icon menu: %#v", menu)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user