From 16f60cedb31d3c7a6aa160d8f00df1825ce32ed5 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 25 Dec 2019 12:43:32 -0800 Subject: [PATCH] test: increase coverage for _http_incoming.js Add coverage for IncomingMessage.prototype.connection setter. PR-URL: https://github.com/nodejs/node/pull/31093 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Yongsheng Zhang Reviewed-By: David Carlier Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat Reviewed-By: Anto Aravinth --- ...-http-incoming-message-connection-setter.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/parallel/test-http-incoming-message-connection-setter.js diff --git a/test/parallel/test-http-incoming-message-connection-setter.js b/test/parallel/test-http-incoming-message-connection-setter.js new file mode 100644 index 00000000000000..82093e1a7939f0 --- /dev/null +++ b/test/parallel/test-http-incoming-message-connection-setter.js @@ -0,0 +1,18 @@ +'use strict'; + +// Test that the setter for http.IncomingMessage,prototype.connection sets the +// socket property too. +require('../common'); + +const assert = require('assert'); +const http = require('http'); + +const incomingMessage = new http.IncomingMessage(); + +assert.strictEqual(incomingMessage.connection, undefined); +assert.strictEqual(incomingMessage.socket, undefined); + +incomingMessage.connection = 'fhqwhgads'; + +assert.strictEqual(incomingMessage.connection, 'fhqwhgads'); +assert.strictEqual(incomingMessage.socket, 'fhqwhgads');