Skip to content

Commit 0b9c3a3

Browse files
committed
test: add test for tls.parseCertString
It does not currently have any explicit tests to verify the behavior. PR-URL: #4283 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 435d571 commit 0b9c3a3

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const assert = require('assert');
5+
const tls = require('tls');
6+
7+
const singles = 'C=US\nST=CA\nL=SF\nO=Node.js Foundation\nOU=Node.js\nCN=ca1\n'
8+
9+
const singlesOut = tls.parseCertString(singles);
10+
assert.deepEqual(singlesOut, {
11+
C: 'US',
12+
ST: 'CA',
13+
L: 'SF',
14+
O: 'Node.js Foundation',
15+
OU: 'Node.js',
16+
CN: 'ca1',
17+
emailAddress: '[email protected]'
18+
});
19+
20+
const doubles = 'OU=Domain Control Validated\nOU=PositiveSSL Wildcard\n' +
21+
'CN=*.nodejs.org';
22+
const doublesOut = tls.parseCertString(doubles);
23+
assert.deepEqual(doublesOut, {
24+
OU: [ 'Domain Control Validated', 'PositiveSSL Wildcard' ],
25+
CN: '*.nodejs.org'
26+
});

0 commit comments

Comments
 (0)