Skip to content

Commit 91fac08

Browse files
Trottitaloacasas
authored andcommitted
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: #11408 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 46084e3 commit 91fac08

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
'use strict';
2-
require('../common');
2+
const common = require('../common');
33
const assert = require('assert');
44
const http = require('http');
55

66
assert.throws(
77
() => { http.request({method: '\0'}); },
8-
(error) => {
9-
return (error instanceof TypeError) &&
10-
/Method must be a valid HTTP token/.test(error);
11-
}
8+
common.expectsError(undefined, TypeError, 'Method must be a valid HTTP token')
129
);

0 commit comments

Comments
 (0)