diff options
author | Evan Lucas <evanlucas@me.com> | 2015-12-14 18:33:47 -0600 |
---|---|---|
committer | Evan Lucas <evanlucas@me.com> | 2015-12-15 08:09:29 -0600 |
commit | 0b9c3a30d67b404198e3c91f3631ec98c61f4983 (patch) | |
tree | ffdf31686f272e161505659e560f01f8340841ea /test/parallel/test-tls-parse-cert-string.js | |
parent | 435d571f225aeffe683035f4f6b7f4a5ef0d1f23 (diff) | |
download | android-node-v8-0b9c3a30d67b404198e3c91f3631ec98c61f4983.tar.gz android-node-v8-0b9c3a30d67b404198e3c91f3631ec98c61f4983.tar.bz2 android-node-v8-0b9c3a30d67b404198e3c91f3631ec98c61f4983.zip |
test: add test for tls.parseCertString
It does not currently have any explicit tests to verify the behavior.
PR-URL: https://github.com/nodejs/node/pull/4283
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'test/parallel/test-tls-parse-cert-string.js')
-rw-r--r-- | test/parallel/test-tls-parse-cert-string.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/parallel/test-tls-parse-cert-string.js b/test/parallel/test-tls-parse-cert-string.js new file mode 100644 index 0000000000..57180c9ce9 --- /dev/null +++ b/test/parallel/test-tls-parse-cert-string.js @@ -0,0 +1,26 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const tls = require('tls'); + +const singles = 'C=US\nST=CA\nL=SF\nO=Node.js Foundation\nOU=Node.js\nCN=ca1\n' + + 'emailAddress=ry@clouds.org'; +const singlesOut = tls.parseCertString(singles); +assert.deepEqual(singlesOut, { + C: 'US', + ST: 'CA', + L: 'SF', + O: 'Node.js Foundation', + OU: 'Node.js', + CN: 'ca1', + emailAddress: 'ry@clouds.org' +}); + +const doubles = 'OU=Domain Control Validated\nOU=PositiveSSL Wildcard\n' + + 'CN=*.nodejs.org'; +const doublesOut = tls.parseCertString(doubles); +assert.deepEqual(doublesOut, { + OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ], + CN: '*.nodejs.org' +}); |