Skip to content

Commit

Permalink
test: use common.expectsError()
Browse files Browse the repository at this point in the history
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: nodejs#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>
  • Loading branch information
Trott authored and italoacasas committed Feb 25, 2017
1 parent 46084e3 commit 91fac08
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions test/parallel/test-http-request-invalid-method-error.js
Original file line number Diff line number Diff line change
@@ -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')
);

0 comments on commit 91fac08

Please sign in to comment.