feat: add forcedSlowMode rate limit to Team and Organization DELETE endpoints (#27258)
* feat: add forcedSlowMode rate limit to Team and Organization DELETE endpoints Co-Authored-By: alex@cal.com <me@alexvanandel.com> * test: add NoOpThrottlerGuard to disable rate limiting in tests - Create NoOpThrottlerGuard class that always allows requests through - Create withNoThrottler helper function to override CustomThrottlerGuard - Update teams.controller.e2e-spec.ts to use withNoThrottler - Update organizations-teams.controller.e2e-spec.ts to use withNoThrottler - Update organizations-organizations.controller.e2e-spec.ts to use withNoThrottler This prevents race conditions when tests fire rapidly against rate-limited endpoints. Co-Authored-By: alex@cal.com <me@alexvanandel.com> * fix: use jest.spyOn to mock throttler guard in tests Changed approach from overrideGuard to jest.spyOn for mocking CustomThrottlerGuard.handleRequest to always return true. This properly disables rate limiting in tests for the DELETE endpoints. Co-Authored-By: alex@cal.com <me@alexvanandel.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
This commit is contained in:
co-authored by
alex@cal.com <me@alexvanandel.com>
Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Morgan
parent
0bcb110d20
commit
7ce1ee5cea
@@ -0,0 +1,5 @@
|
||||
import { CustomThrottlerGuard } from "@/lib/throttler-guard";
|
||||
|
||||
export const mockThrottlerGuard = (): void => {
|
||||
jest.spyOn(CustomThrottlerGuard.prototype, "handleRequest").mockResolvedValue(true);
|
||||
};
|
||||
Reference in New Issue
Block a user