summaryrefslogtreecommitdiff
path: root/test/parallel/test-http-request-invalid-method-error.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-02-15 15:09:23 -0800
committerRich Trott <rtrott@gmail.com>2017-02-17 23:40:19 -0800
commit1f911e1cd10fb1580fae7625485f2d87b30bba7f (patch)
tree9ef0c40bb593360bc961ce809518e9310dad6a2c /test/parallel/test-http-request-invalid-method-error.js
parent749fac0bf60f470c25c5421d4fe659d0efd982af (diff)
downloadandroid-node-v8-1f911e1cd10fb1580fae7625485f2d87b30bba7f.tar.gz
android-node-v8-1f911e1cd10fb1580fae7625485f2d87b30bba7f.tar.bz2
android-node-v8-1f911e1cd10fb1580fae7625485f2d87b30bba7f.zip
test: use common.expectsError()
Use common.expectsError() instead of rolling own validation function in test-http-request-invalid-method-error.js. common.expectsError() didn't exist when the test was written, but now it does. PR-URL: https://github.com/nodejs/node/pull/11408 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel/test-http-request-invalid-method-error.js')
-rw-r--r--test/parallel/test-http-request-invalid-method-error.js7
1 files changed, 2 insertions, 5 deletions
diff --git a/test/parallel/test-http-request-invalid-method-error.js b/test/parallel/test-http-request-invalid-method-error.js
index febb340eac..00f593fa6f 100644
--- a/test/parallel/test-http-request-invalid-method-error.js
+++ b/test/parallel/test-http-request-invalid-method-error.js
@@ -1,12 +1,9 @@
'use strict';
-require('../common');
+const common = require('../common');
const assert = require('assert');
const http = require('http');
assert.throws(
() => { http.request({method: '\0'}); },
- (error) => {
- return (error instanceof TypeError) &&
- /Method must be a valid HTTP token/.test(error);
- }
+ common.expectsError(undefined, TypeError, 'Method must be a valid HTTP token')
);