test: replace assert.throws w/ common.expectsError

PR-URL: https://github.com/nodejs/node/pull/17557
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Anatoli Papirovski 2017-12-08 16:41:38 -05:00
parent 4df7c190bf
commit 094bfaf769
No known key found for this signature in database
GPG key ID: 614E2E1ABEB4B2C0
19 changed files with 134 additions and 132 deletions

View file

@ -3,7 +3,6 @@
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const assert = require('assert');
const http2 = require('http2');
// Check if correct errors are emitted when wrong type of data is passed
@ -40,19 +39,19 @@ server.listen(0, common.mustCall(() => {
return;
}
assert.throws(
common.expectsError(
() => client.request({
':method': 'CONNECT',
':authority': `localhost:${port}`
}, {
[option]: types[type]
}),
common.expectsError({
{
type: TypeError,
code: 'ERR_INVALID_OPT_VALUE',
message: `The value "${String(types[type])}" is invalid ` +
`for option "${option}"`
})
}
);
});
});