Skip to content

Commit 90d6ef3

Browse files
fixed tests
1 parent 70c8043 commit 90d6ef3

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/proxyAgent.spec.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ describe('HttpsProxyAgent', function() {
8282

8383
describe('constructor', function() {
8484
it('should accept a "string" proxy argument', function() {
85-
var agent = new HttpsProxySocket('https://127.0.0.1:12345');
85+
const agent = new HttpsProxySocket('https://127.0.0.1:12345');
8686
assert.equal('127.0.0.1', agent.proxy.host);
8787
assert.equal(12345, agent.proxy.port);
8888
});
8989

9090
it('should accept a direct argument', function() {
91-
var agent = new HttpsProxySocket({ host: '127.0.0.1', port: 12345 });
91+
const agent = new HttpsProxySocket({ host: '127.0.0.1', port: 12345 });
9292
assert.equal('127.0.0.1', agent.proxy.host);
9393
assert.equal(12345, agent.proxy.port);
9494
});
@@ -104,12 +104,12 @@ describe('HttpsProxyAgent', function() {
104104
res.end(JSON.stringify(req.headers));
105105
});
106106

107-
var proxy = {
107+
const proxy = {
108108
host: '127.0.0.1',
109109
port: sslProxyPort,
110110
rejectUnauthorized: false
111111
};
112-
var agent = makeProxy(proxy);
112+
const agent = makeProxy(proxy);
113113

114114
const response = await fetch('http://127.0.0.1:' + serverPort, { agent });
115115
assert.equal(200, response.status);
@@ -123,7 +123,7 @@ describe('HttpsProxyAgent', function() {
123123
fn(null, false);
124124
};
125125

126-
var agent = makeProxy({
126+
const agent = makeProxy({
127127
host: '127.0.0.1',
128128
port: sslProxyPort,
129129
rejectUnauthorized: false
@@ -132,20 +132,20 @@ describe('HttpsProxyAgent', function() {
132132
try {
133133
await fetch('http://127.0.0.1:' + serverPort, { agent });
134134
assert.fail('Error expected');
135-
} catch (err) {
135+
} catch (err: any) {
136136
assert.equal(true, /407 Proxy Authentication Required/.test(err.message));
137137
}
138138
});
139139

140140
it('should emit an "error" event on the `http.ClientRequest` if the proxy does not exist', async function() {
141141
// port 4 is a reserved, but "unassigned" port
142-
var proxyUri = 'http://127.0.0.1:4';
143-
var agent = makeProxy(proxyUri);
142+
const proxyUri = 'http://127.0.0.1:4';
143+
const agent = makeProxy(proxyUri);
144144

145145
try {
146146
await fetch('http://127.0.0.1:' + serverPort, { agent });
147147
assert.fail('Error expected');
148-
} catch (err) {
148+
} catch (err: any) {
149149
assert.equal('ECONNREFUSED', err.code);
150150
}
151151
});
@@ -157,13 +157,13 @@ describe('HttpsProxyAgent', function() {
157157
res.end(JSON.stringify(req.headers));
158158
});
159159

160-
var agent = makeProxy(
160+
const agent = makeProxy(
161161
{
162162
host: '127.0.0.1',
163163
port: sslProxyPort,
164164
rejectUnauthorized: false
165165
},
166-
null,
166+
undefined,
167167
{ rejectUnauthorized: false }
168168
);
169169

@@ -177,7 +177,7 @@ describe('HttpsProxyAgent', function() {
177177
res.end(JSON.stringify(req.headers));
178178
});
179179

180-
var agent = makeProxy({
180+
const agent = makeProxy({
181181
host: '127.0.0.1',
182182
port: sslProxyPort,
183183
rejectUnauthorized: false
@@ -186,7 +186,7 @@ describe('HttpsProxyAgent', function() {
186186
try {
187187
await fetch('https://127.0.0.1:' + sslServerPort, { agent });
188188
assert.fail('Error expected');
189-
} catch (err) {
189+
} catch (err: any) {
190190
assert.equal('DEPTH_ZERO_SELF_SIGNED_CERT', err.code);
191191
}
192192
});

0 commit comments

Comments
 (0)