Skip to content

Commit 49e047f

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 81d81a5 commit 49e047f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,15 @@ assert.throws(
118118
}
119119
);
120120
}
121+
122+
assert.throws(() => { tls.createSecureContext({ minVersion: 'fhqwhgads' }); },
123+
{
124+
code: 'ERR_TLS_INVALID_PROTOCOL_VERSION',
125+
name: 'TypeError'
126+
});
127+
128+
assert.throws(() => { tls.createSecureContext({ maxVersion: 'fhqwhgads' }); },
129+
{
130+
code: 'ERR_TLS_INVALID_PROTOCOL_VERSION',
131+
name: 'TypeError'
132+
});

0 commit comments

Comments
 (0)