Skip to content

Commit cfdbd3a

Browse files
committed
[test] add tests
1 parent dca48f0 commit cfdbd3a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/create-servers-test.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ test('only http, port 0', function (t) {
5151
});
5252
});
5353

54+
test('only http, timeout', function (t) {
55+
t.plan(5);
56+
var time = 3000000;
57+
createServers({
58+
log: console.log,
59+
timeout: time,
60+
http: 0,
61+
handler: fend
62+
}, function (err, servers) {
63+
console.dir(err);
64+
t.error(err);
65+
t.equals(typeof servers, 'object');
66+
t.equals(typeof servers.http, 'object');
67+
t.equals(typeof servers.http.address().port, 'number');
68+
t.equals(servers.http.timeout, time);
69+
servers.http.close();
70+
});
71+
});
5472

5573
test('only https', function (t) {
5674
t.plan(3);
@@ -71,6 +89,28 @@ test('only https', function (t) {
7189
});
7290
});
7391

92+
test('only https', function (t) {
93+
t.plan(4);
94+
var time = 4000000;
95+
createServers({
96+
log: console.log,
97+
https: {
98+
timeout: time,
99+
port: 3456,
100+
root: path.join(__dirname, 'fixtures'),
101+
cert: 'agent2-cert.pem',
102+
key: 'agent2-key.pem'
103+
},
104+
handler: fend
105+
}, function (err, servers) {
106+
t.error(err);
107+
t.equals(typeof servers, 'object');
108+
t.equals(typeof servers.https, 'object');
109+
t.equals(servers.https.timeout, time);
110+
servers.https.close();
111+
});
112+
});
113+
74114
test('absolute cert path resolution', function (t) {
75115
t.plan(3);
76116
createServers({

0 commit comments

Comments
 (0)