Browse Source

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>
v7.x
Rich Trott 8 years ago
committed by Italo A. Casas
parent
commit
91fac08c3b
No known key found for this signature in database GPG Key ID: 23EFEFE93C4CFFFE
  1. 7
      test/parallel/test-http-request-invalid-method-error.js

7
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')
);

Loading…
Cancel
Save