mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-19 16:17:56 +00:00
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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user