优化结构

This commit is contained in:
Yvan
2026-08-23 00:38:33 +08:00
parent 64459574b2
commit 4e5071ee65
22 changed files with 301 additions and 127 deletions
+10 -7
View File
@@ -3,19 +3,15 @@ package data
import (
"testing"
bizpayment "kra/internal/biz/payment"
dataintegration "kra/internal/data/integration"
integrationmodule "kra/internal/modules/integration"
paymentmodule "kra/internal/modules/payment"
systemmodule "kra/internal/modules/system"
taskmodule "kra/internal/modules/task"
"kra/internal/modules"
"kra/pkg/database/migration"
platformmodule "kra/pkg/module"
)
func testCatalog() platformmodule.Catalog {
return platformmodule.Catalog{Definitions: []platformmodule.Definition{
systemmodule.Definition(), integrationmodule.Definition(), taskmodule.Definition(), paymentmodule.Definition(),
}}
return modules.Catalog()
}
func TestMigrateAllRunsModuleSchemasWithoutBootstrapSeed(t *testing.T) {
@@ -48,6 +44,13 @@ func TestMigrateAllRunsModuleSchemasWithoutBootstrapSeed(t *testing.T) {
if len(communicationRows) != 3 {
t.Fatalf("communication integration rows = %d, want 3", len(communicationRows))
}
var paymentRows int64
if err = db.Model(&dataintegration.ConfigPO{}).Where("kind = ?", "payment").Count(&paymentRows).Error; err != nil {
t.Fatal(err)
}
if paymentRows != int64(len(bizpayment.SupportedPaymentProviders)) {
t.Fatalf("payment integration rows = %d, want %d", paymentRows, len(bizpayment.SupportedPaymentProviders))
}
for _, row := range communicationRows {
if row.Enabled || row.Config == "" {
t.Fatalf("default communication integration = %#v", row)