From 91fac08c3b17fe0881ece39af1429f3491b3c57e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 15 Feb 2017 15:09:23 -0800 Subject: [PATCH] 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 Reviewed-By: Gibson Fahnestock Reviewed-By: Santiago Gimeno Reviewed-By: Colin Ihrig --- test/parallel/test-http-request-invalid-method-error.js | 7 ++----- 1 file 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 febb340eacd2a4..00f593fa6f9701 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') );