Skip to content

Commit

Permalink
test: add coverage for ERR_TLS_INVALID_PROTOCOL_VERSION
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Trott authored and targos committed Dec 5, 2019
1 parent 8204a74 commit ac6ff77
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/parallel/test-tls-basic-validations.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,15 @@ common.expectsInternalAssertion(
}
);
}

assert.throws(() => { tls.createSecureContext({ minVersion: 'fhqwhgads' }); },
{
code: 'ERR_TLS_INVALID_PROTOCOL_VERSION',
name: 'TypeError'
});

assert.throws(() => { tls.createSecureContext({ maxVersion: 'fhqwhgads' }); },
{
code: 'ERR_TLS_INVALID_PROTOCOL_VERSION',
name: 'TypeError'
});

0 comments on commit ac6ff77

Please sign in to comment.