Files
junhong_cmp_fiber/internal/bootstrap/worker_services_test.go
邹进 4f16eb1834 fix: Worker 订单服务注入员工代收款建账能力
批量订购线下支付在 Worker 内建单时,订单服务缺少员工代收款建账能力,
每行都会以“员工代收款建账能力未配置”失败;与 API 进程保持一致。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 15:59:52 +09:00

29 lines
1.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package bootstrap
import (
"reflect"
"testing"
orderSvc "github.com/break/junhong_cmp_fiber/internal/service/order"
"github.com/break/junhong_cmp_fiber/pkg/queue"
"go.uber.org/zap"
)
// 批量订购线下支付在 Worker 内建单,订单服务必须注入员工代收款建账能力,
// 否则每行都会以“员工代收款建账能力未配置”失败。
func TestInitWorkerServices_OrderServiceHasEmployeeCollectionBillCreation(t *testing.T) {
services := initWorkerServices(&queue.WorkerStores{}, &WorkerDependencies{Logger: zap.NewNop()})
svc, ok := services.AssetPackageOrderCreator.(*orderSvc.Service)
if !ok {
t.Fatalf("AssetPackageOrderCreator 类型为 %T,期望 *order.Service", services.AssetPackageOrderCreator)
}
billCreation := reflect.ValueOf(svc).Elem().FieldByName("billCreation")
if !billCreation.IsValid() {
t.Fatal("order.Service 缺少 billCreation 字段,请同步更新本测试")
}
if billCreation.IsNil() {
t.Fatal("Worker 订单服务未注入员工代收款建账能力")
}
}