From 6860ace4affbd4c4195bc3391862573b0ad32800 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 30 May 2024 15:07:49 -0700 Subject: [PATCH] Nick: --- apps/api/src/__tests__/e2e_withAuth/index.test.ts | 2 +- apps/api/src/services/rate-limiter.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/api/src/__tests__/e2e_withAuth/index.test.ts b/apps/api/src/__tests__/e2e_withAuth/index.test.ts index 6c24b60..8346839 100644 --- a/apps/api/src/__tests__/e2e_withAuth/index.test.ts +++ b/apps/api/src/__tests__/e2e_withAuth/index.test.ts @@ -1004,7 +1004,7 @@ describe("E2E Tests for API Routes", () => { describe("Rate Limiter", () => { it("should return 429 when rate limit is exceeded for preview token", async () => { - for (let i = 0; i < 5; i++) { + for (let i = 0; i < 4; i++) { const response = await request(TEST_URL) .post("/v0/scrape") .set("Authorization", `Bearer this_is_just_a_preview_token`) diff --git a/apps/api/src/services/rate-limiter.ts b/apps/api/src/services/rate-limiter.ts index a0a6f16..d7e34d9 100644 --- a/apps/api/src/services/rate-limiter.ts +++ b/apps/api/src/services/rate-limiter.ts @@ -57,6 +57,7 @@ export function getRateLimiter(mode: RateLimiterMode, token: string, plan?: stri if (token.includes("5089cefa58") || token.includes("6254cf9")) { return testSuiteRateLimiter; } + const rateLimitConfig = RATE_LIMITS[mode]; if (!rateLimitConfig) return serverRateLimiter;