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.
This commit is contained in:
shaw
2026-09-07 19:00:04 +08:00
parent d106b3b5a0
commit b491c3271b
2 changed files with 4 additions and 4 deletions
@@ -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}
@@ -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),