Skip to content

Commit ac6ff77

Browse files
Trotttargos
authored andcommitted
test: add coverage for ERR_TLS_INVALID_PROTOCOL_VERSION
There is currently no test that confirms that an invalid TLS protocol results in ERR_TLS_INVALID_PROTOCOL_VERSION. Add tests to check this for the `minVersion` and `maxVersion` options in `createSecureContext()`. Refs: https://codecov.io/gh/nodejs/node/src/c14c476614e3134867ddb997bdfe5a41ba668175/lib/_tls_common.js#L56 Refs: https://coverage.nodejs.org/coverage-c14c476614e31348/lib/_tls_common.js.html#L56 PR-URL: #30741 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 8204a74 commit ac6ff77

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/parallel/test-tls-basic-validations.js

+12
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,15 @@ common.expectsInternalAssertion(
114114
}
115115
);
116116
}
117+
118+
assert.throws(() => { tls.createSecureContext({ minVersion: 'fhqwhgads' }); },
119+
{
120+
code: 'ERR_TLS_INVALID_PROTOCOL_VERSION',
121+
name: 'TypeError'
122+
});
123+
124+
assert.throws(() => { tls.createSecureContext({ maxVersion: 'fhqwhgads' }); },
125+
{
126+
code: 'ERR_TLS_INVALID_PROTOCOL_VERSION',
127+
name: 'TypeError'
128+
});

0 commit comments

Comments
 (0)