summaryrefslogtreecommitdiff
path: root/deps/npm/test/tap/config-certfile.js
blob: 4b960672ad79e5f0dab488189b587e8903bf9b47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require('./00-config-setup.js')

var path = require('path')
var fs = require('fs')
var test = require('tap').test
var npmconf = require('../../lib/config/core.js')

test('cafile loads as ca', function (t) {
  var cafile = path.join(__dirname, '..', 'fixtures', 'config', 'multi-ca')

  npmconf.load({cafile: cafile}, function (er, conf) {
    if (er) throw er

    t.same(conf.get('cafile'), cafile)
    var ca = fs.readFileSync(cafile, 'utf8').trim()
    t.same(conf.get('ca').join(ca.match(/\r/g) ? '\r\n' : '\n'), ca)
    t.end()
  })
})