refactor platform menus and entity statuses

This commit is contained in:
david
2026-07-29 13:18:52 +08:00
parent 978dc446d9
commit afd9dbdeb5
48 changed files with 510 additions and 421 deletions

View File

@@ -3,6 +3,8 @@ package seed
import (
"regexp"
"testing"
"git.apinb.com/heqiapp/platforms/backend/api/internal/logic/common"
)
func TestMockEntityIdentitiesAreStableAndUnique(t *testing.T) {
@@ -11,7 +13,7 @@ func TestMockEntityIdentitiesAreStableAndUnique(t *testing.T) {
)
seen := make(map[string]struct{}, 46)
for sequence := 1; sequence <= 46; sequence++ {
record := entity(sequence, "enabled")
record := entity(sequence, common.StatusEnable)
if !identityPattern.MatchString(record.Identity) {
t.Fatalf("entity(%d) identity = %q", sequence, record.Identity)
}
@@ -19,7 +21,7 @@ func TestMockEntityIdentitiesAreStableAndUnique(t *testing.T) {
t.Fatalf("duplicate identity %q", record.Identity)
}
seen[record.Identity] = struct{}{}
if record.Status != "enabled" || record.Version != 1 {
if record.Status != common.StatusEnable || record.Version != 1 {
t.Fatalf("entity(%d) has unexpected defaults: %#v", sequence, record)
}
}