修复 Context 改造后的编译问题
This commit is contained in:
@@ -246,7 +246,7 @@ func TestRuntimePaymentConfigRequiredFields(t *testing.T) {
|
||||
func TestServiceStartRequiresNonZeroOrderID(t *testing.T) {
|
||||
svc := &Service{repo: &Repository{}}
|
||||
|
||||
_, err := svc.Start(1, 0, StartPaymentRequest{}, "127.0.0.1")
|
||||
_, err := svc.Start(t.Context(), 1, 0, StartPaymentRequest{}, "127.0.0.1")
|
||||
if !errors.Is(err, ErrPaymentCannotStart) {
|
||||
t.Fatalf("error = %v, want ErrPaymentCannotStart", err)
|
||||
}
|
||||
@@ -255,7 +255,7 @@ func TestServiceStartRequiresNonZeroOrderID(t *testing.T) {
|
||||
func TestServiceStartRequiresNonZeroUserID(t *testing.T) {
|
||||
svc := &Service{repo: &Repository{}}
|
||||
|
||||
_, err := svc.Start(0, 100, StartPaymentRequest{}, "127.0.0.1")
|
||||
_, err := svc.Start(t.Context(), 0, 100, StartPaymentRequest{}, "127.0.0.1")
|
||||
if !errors.Is(err, ErrPaymentCannotStart) {
|
||||
t.Fatalf("error = %v, want ErrPaymentCannotStart", err)
|
||||
}
|
||||
@@ -264,12 +264,12 @@ func TestServiceStartRequiresNonZeroUserID(t *testing.T) {
|
||||
func TestServiceStartRefundRequiresPositiveAmount(t *testing.T) {
|
||||
svc := &Service{repo: &Repository{}}
|
||||
|
||||
_, err := svc.StartRefund(100, 0, "cancel_refund", "test")
|
||||
_, err := svc.StartRefund(t.Context(), 100, 0, "cancel_refund", "test")
|
||||
if !errors.Is(err, ErrRefundCannotStart) {
|
||||
t.Fatalf("error = %v, want ErrRefundCannotStart", err)
|
||||
}
|
||||
|
||||
_, err = svc.StartRefund(100, -1000, "cancel_refund", "test")
|
||||
_, err = svc.StartRefund(t.Context(), 100, -1000, "cancel_refund", "test")
|
||||
if !errors.Is(err, ErrRefundCannotStart) {
|
||||
t.Fatalf("error = %v, want ErrRefundCannotStart", err)
|
||||
}
|
||||
@@ -278,7 +278,7 @@ func TestServiceStartRefundRequiresPositiveAmount(t *testing.T) {
|
||||
func TestServiceStartRefundRequiresNonZeroOrderID(t *testing.T) {
|
||||
svc := &Service{repo: &Repository{}}
|
||||
|
||||
_, err := svc.StartRefund(0, 1000, "cancel_refund", "test")
|
||||
_, err := svc.StartRefund(t.Context(), 0, 1000, "cancel_refund", "test")
|
||||
if !errors.Is(err, ErrRefundCannotStart) {
|
||||
t.Fatalf("error = %v, want ErrRefundCannotStart", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user