test(goauto): seed current purchase rule in SYB fixtures (#127)
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"go-admin/app/goauto/migrations"
|
||||
"go-admin/app/goauto/models"
|
||||
"go-admin/app/goauto/purchasecontract"
|
||||
"go-admin/app/goauto/shopeeproduct"
|
||||
"go-admin/app/goauto/sybimport"
|
||||
|
||||
@@ -26,6 +27,13 @@ func openTestDB(t *testing.T) *gorm.DB {
|
||||
if err := migrations.Migrate(db); err != nil {
|
||||
t.Fatalf("migrate: %v", err)
|
||||
}
|
||||
currentRule := models.PurchaseRule{Name: "测试当前采购规则", ContentJSON: string(purchasecontract.DefaultLiveRule())}
|
||||
if err := db.Create(¤tRule).Error; err != nil {
|
||||
t.Fatalf("seed purchase rule: %v", err)
|
||||
}
|
||||
if err := db.Create(&models.PurchaseRuleSetting{ID: 1, RuleID: currentRule.ID}).Error; err != nil {
|
||||
t.Fatalf("seed current purchase rule: %v", err)
|
||||
}
|
||||
return db
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user