summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-res-write-end-dont-take-array.js
diff options
context:
space:
mode:
authorIlya Sotov <sotovilya@yandex.ru>2018-04-21 13:41:10 +0300
committerTrivikram Kamat <16024985+trivikr@users.noreply.github.com>2018-04-23 08:28:50 -0700
commit12b90b4546cdfef1adabaa661a33c98173a1a3f5 (patch)
tree8cc7d41f6430017a41103091edcfecc274856b89 /test/parallel/test-http-res-write-end-dont-take-array.js
parent67e2a15d758035e16f3fc4dbe1d56033277765bb (diff)
downloadnode-new-12b90b4546cdfef1adabaa661a33c98173a1a3f5.tar.gz
test: improve http res write and end dont take array
PR-URL: https://github.com/nodejs/node/pull/20199 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-http-res-write-end-dont-take-array.js')
-rw-r--r--test/parallel/test-http-res-write-end-dont-take-array.js23
1 files changed, 17 insertions, 6 deletions
diff --git a/test/parallel/test-http-res-write-end-dont-take-array.js b/test/parallel/test-http-res-write-end-dont-take-array.js
index 94b105cb18..fbe71bd6fc 100644
--- a/test/parallel/test-http-res-write-end-dont-take-array.js
+++ b/test/parallel/test-http-res-write-end-dont-take-array.js
@@ -35,15 +35,26 @@ server.once('request', common.mustCall((req, res) => {
// write should accept buffer
res.write(Buffer.from('asdf'));
+ const expectedError = {
+ code: 'ERR_INVALID_ARG_TYPE',
+ name: 'TypeError [ERR_INVALID_ARG_TYPE]',
+ };
+
// write should not accept an Array
- assert.throws(function() {
- res.write(['array']);
- }, TypeError, 'first argument must be a string or Buffer');
+ assert.throws(
+ () => {
+ res.write(['array']);
+ },
+ expectedError
+ );
// end should not accept an Array
- assert.throws(function() {
- res.end(['moo']);
- }, TypeError, 'first argument must be a string or Buffer');
+ assert.throws(
+ () => {
+ res.end(['moo']);
+ },
+ expectedError
+ );
// end should accept string
res.end('string');