test: add asserts to validate test assumptions

Refs: https://github.com/nodejs/node/pull/54968
Refs: https://github.com/nodejs/node/issues/53382

Add additional asserts as suggestd by Richard in:
https://github.com/nodejs/node/pull/54968

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: https://github.com/nodejs/node/pull/54997
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Michael Dawson 2024-09-18 20:35:20 +00:00
parent 81cc72996a
commit 29b9c72b05

View File

@ -22,6 +22,7 @@
'use strict';
const common = require('../common');
const fixtures = require('../common/fixtures');
const assert = require('assert');
if (!common.hasCrypto)
common.skip('missing crypto');
@ -43,6 +44,8 @@ while (cert[cert.length - 1 - i] === 0x0a) i++;
if (i !== 0) cert = cert.slice(0, cert.length - i);
function test(cert, key, cb) {
assert.notStrictEqual(cert.at(-1), 0x0a);
assert.notStrictEqual(key.at(-1), 0x0a);
const server = tls.createServer({
cert,
key