Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Mar 30, 2024
1 parent 8e2e876 commit 5a4d18b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
9 changes: 5 additions & 4 deletions packages/https-proxy-agent/test/e2e.test.ts
Expand Up @@ -61,7 +61,7 @@ describe('HttpsProxyAgent', () => {
}
);
console.log(
`Using NordVPN HTTPS proxy server: ${server.name} (${server.hostname})`
`Using NordVPN "proxy_ssl" server: ${server.name} (${server.hostname})`
);
});

Expand All @@ -74,8 +74,6 @@ describe('HttpsProxyAgent', () => {
throw new Error('`NORDVPN_PASSWORD` env var is not defined');
}

const realIp = await getRealIP();

const username = encodeURIComponent(NORDVPN_USERNAME);
const password = encodeURIComponent(NORDVPN_PASSWORD);

Expand All @@ -85,7 +83,10 @@ describe('HttpsProxyAgent', () => {
`https://${username}:${password}@${server.hostname}:89`
);

const res = await req('https://dump.n8.io', { agent });
const [res, realIp] = await Promise.all([
req('https://dump.n8.io', { agent }),
getRealIP(),
]);
const body = await json(res);
expect(body.request.headers['x-real-ip']).not.toEqual(realIp);
expect(body.request.headers['x-vercel-ip-country']).toEqual(
Expand Down
11 changes: 5 additions & 6 deletions packages/socks-proxy-agent/test/e2e.test.ts
Expand Up @@ -43,7 +43,6 @@ describe('SocksProxyAgent', () => {
s.status === 'online' &&
s.technologies.find((t) => t.identifier === 'socks')
);
console.log(servers.length);
if (servers.length === 0) {
throw new Error(
'Could not find `https` proxy server from NordVPN'
Expand All @@ -61,7 +60,7 @@ describe('SocksProxyAgent', () => {
}
);
console.log(
`Using NordVPN HTTPS proxy server: ${server.name} (${server.hostname})`
`Using NordVPN "socks" server: ${server.name} (${server.hostname})`
);
});

Expand All @@ -74,16 +73,16 @@ describe('SocksProxyAgent', () => {
throw new Error('`NORDVPN_PASSWORD` env var is not defined');
}

const realIp = await getRealIP();

const username = encodeURIComponent(NORDVPN_USERNAME);
const password = encodeURIComponent(NORDVPN_PASSWORD);

const agent = new SocksProxyAgent(
`socks://${username}:${password}@${server.hostname}`
);

const res = await req('https://dump.n8.io', { agent });
const [res, realIp] = await Promise.all([
req('https://dump.n8.io', { agent }),
getRealIP(),
]);
const body = await json(res);
expect(body.request.headers['x-real-ip']).not.toEqual(realIp);
expect(body.request.headers['x-vercel-ip-country']).toEqual(
Expand Down

0 comments on commit 5a4d18b

Please sign in to comment.