mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
[node-tests.ts] Clean up http_tests and net_tests (#11240)
* Clean up http_tests and net_tests * Clean up fs tests and wrap in namespace
This commit is contained in:
committed by
Masahiro Wakame
parent
89030200ce
commit
62f98f1a3b
@@ -379,27 +379,18 @@ var tlsOpts: tls.TlsOptions = {
|
||||
};
|
||||
var tlsSocket = tls.connect(tlsOpts);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Http tests : http://nodejs.org/api/http.html ///
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// Make sure .listen() and .close() retuern a Server instance
|
||||
http.createServer().listen(0).close().address();
|
||||
net.createServer().listen(0).close().address();
|
||||
|
||||
var request = http.request('http://0.0.0.0');
|
||||
request.once('error', function () {});
|
||||
request.setNoDelay(true);
|
||||
request.abort();
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Http tests : http://nodejs.org/api/http.html
|
||||
////////////////////////////////////////////////////
|
||||
namespace http_tests {
|
||||
// Status codes
|
||||
var code = 100;
|
||||
var codeMessage = http.STATUS_CODES['400'];
|
||||
var codeMessage = http.STATUS_CODES[400];
|
||||
{
|
||||
// Status codes
|
||||
var codeMessage = http.STATUS_CODES['400'];
|
||||
var codeMessage = http.STATUS_CODES[400];
|
||||
}
|
||||
|
||||
{
|
||||
var agent: http.Agent = new http.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 10000,
|
||||
@@ -409,20 +400,29 @@ namespace http_tests {
|
||||
|
||||
var agent: http.Agent = http.globalAgent;
|
||||
|
||||
http.request({
|
||||
agent: false
|
||||
});
|
||||
http.request({
|
||||
agent: agent
|
||||
});
|
||||
http.request({
|
||||
agent: undefined
|
||||
});
|
||||
http.request({agent: false});
|
||||
http.request({agent: agent});
|
||||
http.request({agent: undefined});
|
||||
}
|
||||
|
||||
{
|
||||
// Make sure .listen() and .close() retuern a Server instance
|
||||
http.createServer().listen(0).close().address();
|
||||
net.createServer().listen(0).close().address();
|
||||
}
|
||||
|
||||
{
|
||||
var request = http.request('http://0.0.0.0');
|
||||
request.once('error', function() { });
|
||||
request.setNoDelay(true);
|
||||
request.abort();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Https tests : http://nodejs.org/api/https.html
|
||||
////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////
|
||||
/// Https tests : http://nodejs.org/api/https.html ///
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
namespace https_tests {
|
||||
var agent: https.Agent = new https.Agent({
|
||||
keepAlive: true,
|
||||
@@ -927,3 +927,14 @@ namespace console_tests {
|
||||
_c = c;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
/// Net Tests : https://nodejs.org/api/net.html ///
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
namespace net_tests {
|
||||
{
|
||||
// Make sure .listen() and .close() retuern a Server instance
|
||||
net.createServer().listen(0).close().address();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,27 +554,18 @@ var connOpts: tls.ConnectionOptions = {
|
||||
};
|
||||
var tlsSocket = tls.connect(connOpts);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Http tests : http://nodejs.org/api/http.html ///
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
// Make sure .listen() and .close() retuern a Server instance
|
||||
http.createServer().listen(0).close().address();
|
||||
net.createServer().listen(0).close().address();
|
||||
|
||||
var request = http.request('http://0.0.0.0');
|
||||
request.once('error', function () {});
|
||||
request.setNoDelay(true);
|
||||
request.abort();
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Http tests : http://nodejs.org/api/http.html
|
||||
////////////////////////////////////////////////////
|
||||
namespace http_tests {
|
||||
// Status codes
|
||||
var code = 100;
|
||||
var codeMessage = http.STATUS_CODES['400'];
|
||||
var codeMessage = http.STATUS_CODES[400];
|
||||
{
|
||||
// Status codes
|
||||
var codeMessage = http.STATUS_CODES['400'];
|
||||
var codeMessage = http.STATUS_CODES[400];
|
||||
}
|
||||
|
||||
{
|
||||
var agent: http.Agent = new http.Agent({
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 10000,
|
||||
@@ -584,20 +575,29 @@ namespace http_tests {
|
||||
|
||||
var agent: http.Agent = http.globalAgent;
|
||||
|
||||
http.request({
|
||||
agent: false
|
||||
});
|
||||
http.request({
|
||||
agent: agent
|
||||
});
|
||||
http.request({
|
||||
agent: undefined
|
||||
});
|
||||
http.request({agent: false});
|
||||
http.request({agent: agent});
|
||||
http.request({agent: undefined});
|
||||
}
|
||||
|
||||
{
|
||||
// Make sure .listen() and .close() retuern a Server instance
|
||||
http.createServer().listen(0).close().address();
|
||||
net.createServer().listen(0).close().address();
|
||||
}
|
||||
|
||||
{
|
||||
var request = http.request('http://0.0.0.0');
|
||||
request.once('error', function() { });
|
||||
request.setNoDelay(true);
|
||||
request.abort();
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// Https tests : http://nodejs.org/api/https.html
|
||||
////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////
|
||||
/// Https tests : http://nodejs.org/api/https.html ///
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
namespace https_tests {
|
||||
var agent: https.Agent = new https.Agent({
|
||||
keepAlive: true,
|
||||
@@ -1134,6 +1134,17 @@ namespace console_tests {
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
/// Net Tests : https://nodejs.org/api/net.html ///
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
namespace net_tests {
|
||||
{
|
||||
// Make sure .listen() and .close() retuern a Server instance
|
||||
net.createServer().listen(0).close().address();
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* *
|
||||
* The following tests are the modules not mentioned in document but existed *
|
||||
|
||||
Reference in New Issue
Block a user