* Creates mock request objects for testing
(options = {})
| 33 | * Creates mock request objects for testing |
| 34 | */ |
| 35 | function createMockRequest (options = {}) { |
| 36 | return { |
| 37 | method: options.method || "GET", |
| 38 | url: options.url || "/protected/resource", |
| 39 | headers: options.headers || {}, |
| 40 | sessionID: options.sessionID || "test-session-123", |
| 41 | ip: options.ip || "127.0.0.1", |
| 42 | parsed: { |
| 43 | pathname: options.url || "/protected/resource", |
| 44 | searchParams: new URLSearchParams() |
| 45 | }, |
| 46 | body: options.body || "", |
| 47 | isAuthenticated: options.isAuthenticated || (() => false), |
| 48 | ...options |
| 49 | }; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Creates mock response objects for testing |
no outgoing calls
no test coverage detected