in-process-request
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -11,4 +11,4 @@ "use strict"; | ||
return new Promise((resolve) => { | ||
const req = httpMock_1.createMockRequest(reqOptions); | ||
const res = httpMock_1.createMockResponse(req); | ||
const req = (0, httpMock_1.createMockRequest)(reqOptions); | ||
const res = (0, httpMock_1.createMockResponse)(req); | ||
res.once('__mock_response', resolve); | ||
@@ -15,0 +15,0 @@ app(req, res); |
@@ -46,3 +46,3 @@ "use strict"; | ||
}; | ||
exports.createMockResponse = (req) => { | ||
const createMockResponse = (req) => { | ||
const res = new http_1.ServerResponse(req); | ||
@@ -69,2 +69,3 @@ res.shouldKeepAlive = false; | ||
headers[name.toLowerCase()] = strVal; | ||
return res; | ||
}; | ||
@@ -98,6 +99,8 @@ res.end = (chunkOrCallback, encodingOrCallback, maybeCallback) => { | ||
} | ||
return res; | ||
}; | ||
return res; | ||
}; | ||
exports.createMockRequest = (opts) => { | ||
exports.createMockResponse = createMockResponse; | ||
const createMockRequest = (opts) => { | ||
const socket = { | ||
@@ -109,2 +112,5 @@ remoteAddress: opts.remoteAddress || '123.123.123.123', | ||
destroy: () => { }, | ||
readable: true, | ||
on: () => undefined, | ||
removeListener: () => undefined, | ||
}; | ||
@@ -134,1 +140,2 @@ const body = toBuffer(opts.body); | ||
}; | ||
exports.createMockRequest = createMockRequest; |
{ | ||
"name": "in-process-request", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"license": "(MIT OR Apache-2.0)", | ||
@@ -38,9 +38,9 @@ "scripts": { | ||
"devDependencies": { | ||
"@types/jest": "^26.0.15", | ||
"@types/node": "^14.14.6", | ||
"jest": "^26.6.3", | ||
"ts-jest": "^26.4.3", | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.0.5" | ||
"@types/jest": "^27.4.1", | ||
"@types/node": "^17.0.23", | ||
"jest": "^27.5.1", | ||
"ts-jest": "^27.1.4", | ||
"ts-node": "^10.7.0", | ||
"typescript": "^4.6.3" | ||
} | ||
} |
@@ -12,2 +12,3 @@ # in-process-request | ||
* Apollo Server v2 | ||
* Apollo Server v3 | ||
* Hapi v19 | ||
@@ -14,0 +15,0 @@ * Hapi v20 |
22029
261
382