mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
test: make test-tls-connect checks more strict
Check the error code on expected errors so that the introduction of different errors in refactoring is caught. While at it, re-order modules alphabetically per test-writing guide. PR-URL: https://github.com/nodejs/node/pull/14695 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
1 parent
9ed2c4cb0e
commit
91649b913c
1 file changed
+10
-4
@@ -1,13 +1,13 @@
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
if (!common.hasCrypto)
|
||||
common.skip('missing crypto');
|
||||
|
||||
const tls = require('tls');
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const tls = require('tls');
|
||||
|
||||
// https://github.com/joyent/node/issues/1218
|
||||
// uncatchable exception on TLS connection error
|
||||
@@ -18,7 +18,10 @@ const path = require('path');
|
||||
const options = {cert: cert, key: key, port: common.PORT};
|
||||
const conn = tls.connect(options, common.fail);
|
||||
|
||||
conn.on('error', common.mustCall());
|
||||
conn.on(
|
||||
'error',
|
||||
common.mustCall((e) => { assert.strictEqual(e.code, 'ECONNREFUSED'); })
|
||||
);
|
||||
}
|
||||
|
||||
// SSL_accept/SSL_connect error handling
|
||||
@@ -35,5 +38,8 @@ const path = require('path');
|
||||
assert.ok(false); // callback should never be executed
|
||||
});
|
||||
|
||||
conn.on('error', common.mustCall());
|
||||
conn.on(
|
||||
'error',
|
||||
common.mustCall((e) => { assert.strictEqual(e.code, 'ECONNREFUSED'); })
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user