1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
var test = require('tap').test
require('./lib/server.js').close()
var common = require('./lib/common.js')
var config = {
proxy: {
http: 'http://proxy.npm:8088/',
https: 'https://proxy.npm:8043/',
localAddress: 'localhost.localdomain'
},
ssl: {
ca: 'not including a PEM',
certificate: 'still not including a PEM',
key: 'nope',
strict: false
},
retry: {
count: 1,
factor: 9001,
minTimeout: -1,
maxTimeout: Infinity
},
userAgent: 'npm-awesome/4 (Mozilla 5.0)',
log: { fake: function () {} },
defaultTag: 'next',
couchToken: { object: true },
sessionToken: 'hamchunx',
isFromCI: true,
scope: '@test'
}
test('config defaults', function (t) {
var client = common.freshClient(config)
var proxy = client.config.proxy
t.equal(proxy.http, 'http://proxy.npm:8088/')
t.equal(proxy.https, 'https://proxy.npm:8043/')
t.equal(proxy.localAddress, 'localhost.localdomain')
var ssl = client.config.ssl
t.equal(ssl.ca, 'not including a PEM')
t.equal(ssl.certificate, 'still not including a PEM')
t.equal(ssl.key, 'nope')
t.equal(ssl.strict, false)
var retry = client.config.retry
t.equal(retry.count, 1)
t.equal(retry.factor, 9001)
t.equal(retry.minTimeout, -1)
t.equal(retry.maxTimeout, Infinity)
t.equal(client.config.userAgent, 'npm-awesome/4 (Mozilla 5.0)')
t.ok(client.log.fake)
t.equal(client.config.defaultTag, 'next')
t.ok(client.config.couchToken.object)
t.equal(client.config.sessionToken, 'hamchunx')
t.ok(client.config.isFromCI)
t.is(client.config.scope, '@test')
t.end()
})
|