From ece20c99c23ab2daca1dfa6656fb598a25890389 Mon Sep 17 00:00:00 2001 From: Anatoli Papirovski Date: Wed, 20 Sep 2017 08:22:49 -0400 Subject: [PATCH] test: expand http2 util test coverage for headers Expand existing test cases to hit some additional branches of toHeaderObject and mapToHeaders. --- test/parallel/test-http2-cookies.js | 3 ++- test/parallel/test-http2-util-headers-list.js | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-http2-cookies.js b/test/parallel/test-http2-cookies.js index 3e20a5749dd638..b2f0a3bf6c25cc 100644 --- a/test/parallel/test-http2-cookies.js +++ b/test/parallel/test-http2-cookies.js @@ -11,7 +11,8 @@ const server = h2.createServer(); const setCookie = [ 'a=b', - 'c=d; Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly' + 'c=d; Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly', + 'e=f' ]; // we use the lower-level API here diff --git a/test/parallel/test-http2-util-headers-list.js b/test/parallel/test-http2-util-headers-list.js index 8d665120c14776..7e6bb7ece205bc 100644 --- a/test/parallel/test-http2-util-headers-list.js +++ b/test/parallel/test-http2-util-headers-list.js @@ -261,4 +261,10 @@ const regex = })(mapToHeaders({ [name]: 'abc' })); }); +common.expectsError({ + code: 'ERR_HTTP2_INVALID_CONNECTION_HEADERS', + message: regex +})(mapToHeaders({ [HTTP2_HEADER_TE]: ['abc'] })); + assert(!(mapToHeaders({ te: 'trailers' }) instanceof Error)); +assert(!(mapToHeaders({ te: ['trailers'] }) instanceof Error));