From b491c3271bd0ca33da9131528c6a85cfcb08015f Mon Sep 17 00:00:00 2001 From: shaw Date: Mon, 7 Sep 2026 19:00:04 +0800 Subject: [PATCH] fix: rename redeemMaxErrorsPerHour to redeemMaxFailedAttempts in tests #6669 renamed the constant from redeemMaxErrorsPerHour to redeemMaxFailedAttempts (fixed 10-minute window), but #6670's tests still referenced the old name, breaking compilation on main. --- backend/internal/service/payment_fulfillment_test.go | 6 +++--- backend/internal/service/redeem_admin_fulfillment_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/internal/service/payment_fulfillment_test.go b/backend/internal/service/payment_fulfillment_test.go index 3f1fdb1cf6..b1366c3c96 100644 --- a/backend/internal/service/payment_fulfillment_test.go +++ b/backend/internal/service/payment_fulfillment_test.go @@ -764,7 +764,7 @@ func TestFulfillmentLeaseVersionRejectsStaleWorker(t *testing.T) { } func TestPublicRedeemStillEnforcesFailureLimit(t *testing.T) { - cache := &paymentFulfillmentRedeemCacheStub{count: redeemMaxErrorsPerHour} + cache := &paymentFulfillmentRedeemCacheStub{count: redeemMaxFailedAttempts} svc := &RedeemService{cache: cache} result, err := svc.Redeem(context.Background(), 42, "PUBLIC-CODE") @@ -794,7 +794,7 @@ func TestPublicRedeemStillIncrementsInvalidCodeFailures(t *testing.T) { func TestPaymentRedeemDoesNotIncrementFailureLimit(t *testing.T) { ctx := context.Background() - cache := &paymentFulfillmentRedeemCacheStub{count: redeemMaxErrorsPerHour} + cache := &paymentFulfillmentRedeemCacheStub{count: redeemMaxFailedAttempts} redeemRepo := &redeemRejectRepo{code: RedeemCode{ ID: 1, Code: "PAY-EXPIRED", @@ -835,7 +835,7 @@ func TestExecuteBalanceFulfillmentBypassesUserRedeemRateLimit(t *testing.T) { credited += amount return nil } - cache := &paymentFulfillmentRedeemCacheStub{count: redeemMaxErrorsPerHour} + cache := &paymentFulfillmentRedeemCacheStub{count: redeemMaxFailedAttempts} redeemService := NewRedeemService(redeemRepo, userRepo, nil, cache, nil, client, nil, nil) svc := &PaymentService{entClient: client, redeemService: redeemService, userRepo: userRepo} diff --git a/backend/internal/service/redeem_admin_fulfillment_test.go b/backend/internal/service/redeem_admin_fulfillment_test.go index 76e4ff4832..1e7a32c5b0 100644 --- a/backend/internal/service/redeem_admin_fulfillment_test.go +++ b/backend/internal/service/redeem_admin_fulfillment_test.go @@ -25,7 +25,7 @@ func TestAdminFulfillmentBypassesLimitAndKeepsRedeemAffiliate(t *testing.T) { } userRepo := &mockUserRepo{getByIDUser: &User{ID: userID}} userRepo.updateBalanceFn = func(context.Context, int64, float64) error { return nil } - cache := &paymentFulfillmentRedeemCacheStub{count: redeemMaxErrorsPerHour} + cache := &paymentFulfillmentRedeemCacheStub{count: redeemMaxFailedAttempts} affiliateRepo := &paymentFulfillmentAffiliateRepoStub{ inviteeSummary: &AffiliateSummary{ UserID: userID, AffCode: "INVITEE", InviterID: &inviterID, CreatedAt: time.Now().Add(-time.Hour),