fix: order workbench modules

This commit is contained in:
richjohnrambo
2026-09-10 15:19:29 +08:00
parent 085a48c3d9
commit 14ee3d937f
7 changed files with 54 additions and 22 deletions
+2 -2
View File
@@ -2552,7 +2552,7 @@ func TestServeIMWorkbench(t *testing.T) {
oldWorkbench := store.Workbench
oldTenants := store.Tenants
store.Workbench = &testWorkbenchStore{version: 3, modules: []types.WorkbenchModule{
{Code: "organization", Name: "组织架构", Route: "/organization", Enabled: true, Permission: "enabled"},
{Code: "organization", Name: "部门框架", Route: "/organization", SortOrder: 40, Enabled: true, Permission: "enabled"},
{Code: "external", Name: "外部链接", Route: "https://example.com", Enabled: true, Permission: "enabled"},
}}
store.Tenants = testTenantStore{tenant: &types.Tenant{ID: 7, Code: "acme", State: types.TenantStateActive}}
@@ -2579,7 +2579,7 @@ func TestServeIMWorkbench(t *testing.T) {
t.Fatalf("expected external route to be filtered, got %#v", items)
}
item := items[0].(map[string]any)
if item["code"] != "organization" || item["route"] != "/organization" {
if item["code"] != "organization" || item["route"] != "/organization" || item["sort_order"].(float64) != 40 {
t.Fatalf("unexpected module: %#v", item)
}
enterprise := data["enterprise"].(map[string]any)