Skip to content

Commit f495389

Browse files
Trottitaloacasas
authored andcommitted
test: refactor test-tls-cert-chains-in-ca
When splitting PEM string into separate certs, use non-capturing regexp to avoid having to put the split string back with .map(). As a bonus, this splits the PEM into two certs, rather than 2 certs and a third crufty whitespace-only string. PR-URL: #11367 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sam Roberts <[email protected]>
1 parent 6a2f330 commit f495389

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

test/parallel/test-tls-cert-chains-in-ca.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ const {
1212

1313
// agent6-cert.pem includes cert for agent6 and ca3, split it apart and
1414
// provide ca3 in the .ca property.
15-
const agent6Chain = keys.agent6.cert.split('-----END CERTIFICATE-----')
16-
.map((c) => { return c + '-----END CERTIFICATE-----'; });
15+
const agent6Chain = keys.agent6.cert.split(/(?=-----BEGIN CERTIFICATE-----)/);
1716
const agent6End = agent6Chain[0];
1817
const agent6Middle = agent6Chain[1];
1918
connect({

0 commit comments

Comments
 (0)