summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-02-13 20:29:33 -0800
committerRich Trott <rtrott@gmail.com>2017-02-15 20:23:28 -0800
commite2d7df6fdca6620a85981afef522255b571eafcd (patch)
tree79a25ca87160f295d03585a73cb5bc8d5c05425a /test
parent3429991d8b43474cab58f067658b5ce81ace58f8 (diff)
downloadandroid-node-v8-e2d7df6fdca6620a85981afef522255b571eafcd.tar.gz
android-node-v8-e2d7df6fdca6620a85981afef522255b571eafcd.tar.bz2
android-node-v8-e2d7df6fdca6620a85981afef522255b571eafcd.zip
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: https://github.com/nodejs/node/pull/11367 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-tls-cert-chains-in-ca.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/test/parallel/test-tls-cert-chains-in-ca.js b/test/parallel/test-tls-cert-chains-in-ca.js
index 69f62c3f72..3b4e78919f 100644
--- a/test/parallel/test-tls-cert-chains-in-ca.js
+++ b/test/parallel/test-tls-cert-chains-in-ca.js
@@ -12,8 +12,7 @@ const {
// agent6-cert.pem includes cert for agent6 and ca3, split it apart and
// provide ca3 in the .ca property.
-const agent6Chain = keys.agent6.cert.split('-----END CERTIFICATE-----')
- .map((c) => { return c + '-----END CERTIFICATE-----'; });
+const agent6Chain = keys.agent6.cert.split(/(?=-----BEGIN CERTIFICATE-----)/);
const agent6End = agent6Chain[0];
const agent6Middle = agent6Chain[1];
connect({