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 <[email protected]>
  • Loading branch information
evanlucas authored and Myles Borins committed Dec 30, 2015
1 parent 01da04e commit 9bbad89
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/parallel/test-tls-parse-cert-string.js
Original file line number Diff line number Diff line change
@@ -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'
+ '[email protected]';
const singlesOut = tls.parseCertString(singles);
assert.deepEqual(singlesOut, {
C: 'US',
ST: 'CA',
L: 'SF',
O: 'Node.js Foundation',
OU: 'Node.js',
CN: 'ca1',
emailAddress: '[email protected]'
});

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 9bbad89

Please sign in to comment.