* Creates mock request objects for testing
(options = {})
| 36 | * Creates mock request objects for testing |
| 37 | */ |
| 38 | function createMockRequest (options = {}) { |
| 39 | return { |
| 40 | method: options.method || "GET", |
| 41 | url: options.url || "/api/test", |
| 42 | headers: options.headers || {}, |
| 43 | sessionID: options.sessionID || `session-${Math.random()}`, |
| 44 | ip: options.ip || `192.168.1.${Math.floor(Math.random() * 255)}`, |
| 45 | parsed: { |
| 46 | pathname: options.url || "/api/test", |
| 47 | searchParams: new URLSearchParams() |
| 48 | }, |
| 49 | ...options |
| 50 | }; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Creates mock response objects for testing |
no outgoing calls
no test coverage detected