const { apiLimiter, authLimiter } = require('../../middleware/rateLimiter'); describe('Rate Limiter Middleware', () => { describe('API Limiter', () => { it('should be defined', () => { expect(apiLimiter).toBeDefined(); expect(typeof apiLimiter).toBe('function'); }); it('should have proper configuration', () => { // Rate limiter is an Express middleware function expect(apiLimiter.length).toBeGreaterThanOrEqual(3); // (req, res, next) }); }); describe('Auth Limiter', () => { it('should be defined', () => { expect(authLimiter).toBeDefined(); expect(typeof authLimiter).toBe('function'); }); it('should be stricter than API limiter', () => { // Auth limiter should have different (stricter) limits expect(authLimiter).toBeDefined(); }); }); });