From 3d37efe5884bf42e2055ecafd41e9579cd71c57f Mon Sep 17 00:00:00 2001 From: Yoshiki Kurihara Date: Tue, 15 Mar 2022 08:28:11 +0900 Subject: [PATCH] test: improve _http_outgoing coverage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/42213 Refs: https://coverage.nodejs.org/coverage-29bb2bb57d2a993e/lib/_http_outgoing.js.html Reviewed-By: Luigi Pinca Reviewed-By: Juan José Arboleda Reviewed-By: James M Snell Reviewed-By: Darshan Sen --- .../test-http-outgoing-internal-headernames-getter.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/parallel/test-http-outgoing-internal-headernames-getter.js b/test/parallel/test-http-outgoing-internal-headernames-getter.js index 4a56a1301050b5..2d8238066e0cd4 100644 --- a/test/parallel/test-http-outgoing-internal-headernames-getter.js +++ b/test/parallel/test-http-outgoing-internal-headernames-getter.js @@ -2,6 +2,7 @@ const common = require('../common'); const { OutgoingMessage } = require('http'); +const assert = require('assert'); const warn = 'OutgoingMessage.prototype._headerNames is deprecated'; common.expectWarning('DeprecationWarning', warn, 'DEP0066'); @@ -11,3 +12,12 @@ common.expectWarning('DeprecationWarning', warn, 'DEP0066'); const outgoingMessage = new OutgoingMessage(); outgoingMessage._headerNames; // eslint-disable-line no-unused-expressions } + +{ + // Tests _headerNames getter result after setting a header. + const outgoingMessage = new OutgoingMessage(); + outgoingMessage.setHeader('key', 'value'); + const expect = Object.create(null); + expect.key = 'key'; + assert.deepStrictEqual(outgoingMessage._headerNames, expect); +}