(name, module)
| 14 | } |
| 15 | |
| 16 | function wrapRequest (name, module) { |
| 17 | // Just like the http or https module, but note when a request is made. |
| 18 | var wrapped = {} |
| 19 | Object.keys(module).forEach(function (key) { |
| 20 | var value = module[key] |
| 21 | |
| 22 | if (key === 'request') { |
| 23 | wrapped[key] = function (/* options, callback */) { |
| 24 | fauxRequestsMade[name] += 1 |
| 25 | return value.apply(this, arguments) |
| 26 | } |
| 27 | } else { |
| 28 | wrapped[key] = value |
| 29 | } |
| 30 | }) |
| 31 | |
| 32 | return wrapped |
| 33 | } |
| 34 | |
| 35 | var fauxHTTP = wrapRequest('http', http) |
| 36 | var fauxHTTPS = wrapRequest('https', https) |
no outgoing calls
no test coverage detected
searching dependent graphs…