Skip to content

Commit

Permalink
test: add test for tls.parseCertString
Browse files Browse the repository at this point in the history
It does not currently have any explicit tests to verify the behavior.

PR-URL: #4283
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
evanlucas committed Dec 15, 2015
1 parent 435d571 commit 0b9c3a3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions 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'
});

0 comments on commit 0b9c3a3

Please sign in to comment.