* Creates a test server with rate limiting enabled
(rateConfig)
| 15 | * Creates a test server with rate limiting enabled |
| 16 | */ |
| 17 | function createRateLimitedServer (rateConfig) { |
| 18 | return tenso({ |
| 19 | port: 0, |
| 20 | silent: true, |
| 21 | logging: { enabled: false }, |
| 22 | auth: { protect: [] }, |
| 23 | security: { csrf: false }, |
| 24 | rate: { |
| 25 | enabled: true, |
| 26 | limit: 100, |
| 27 | reset: 900, // 15 minutes |
| 28 | status: 429, |
| 29 | message: "Too many requests", |
| 30 | ...rateConfig |
| 31 | } |
| 32 | }); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Creates mock request objects for testing |
no test coverage detected