fix(menu): show dashboard overview as root item
This commit is contained in:
@@ -21,3 +21,28 @@ func TestMenusExcludeInventoryAndEcommerce(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMenuContainsDashboardRoutes(t *testing.T) {
|
||||
want := map[string]string{
|
||||
"dashboard_overview": "/dashboard/overview",
|
||||
}
|
||||
for _, menu := range MenusForRole("admin") {
|
||||
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)
|
||||
}
|
||||
for _, menu := range MenusForRole("admin") {
|
||||
if menu.Identity == "dashboard_overview" && (menu.ParentIdentity != "" || menu.Icon != "icon-dashboard") {
|
||||
t.Fatalf("dashboard overview must be a first-level icon menu: %#v", menu)
|
||||
}
|
||||
if menu.Identity == "dashboard" || menu.Identity == "dashboard_reports" {
|
||||
t.Fatalf("legacy dashboard menu must not be returned: %#v", menu)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user