Skip to content

Commit

Permalink
style: revert auto-formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoaldamav committed Jan 18, 2024
1 parent 550c2e0 commit 451e81f
Showing 1 changed file with 35 additions and 37 deletions.
72 changes: 35 additions & 37 deletions network/proxy-agent/proxy-agent.strict-ssl.spec.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
import fetch from "node-fetch";
import { getProxyAgent } from "./proxy-agent";
import Proxy from "proxy";
import fetch from 'node-fetch'
import { getProxyAgent } from './proxy-agent'
import Proxy from 'proxy'

describe("untrusted certificate", () => {
let proxy: Proxy;
let proxyPort: number;
beforeAll((done) => {
// setup HTTP proxy server
proxy = Proxy();
proxy.listen(() => {
proxyPort = proxy.address().port;
done();
});
});
afterAll((done) => {
proxy.once("close", done);
proxy.close();
});
it("should not throw an error if strictSsl is set to false", async () => {
const url = "https://self-signed.badssl.com";
const agent: any = getProxyAgent(url, {
httpsProxy: `http://127.0.0.1:${proxyPort}`,
strictSsl: false,
});
await fetch(url, { agent });
});
it("should throw an error if strictSsl is not set", async () => {
const url = "https://self-signed.badssl.com";
const agent: any = getProxyAgent(url, {
httpsProxy: `http://127.0.0.1:${proxyPort}`,
strictSsl: true,
});
await expect(fetch(url, { agent })).rejects.toThrow(
/self[- ]signed certificate/,
);
});
});
describe('untrusted certificate', () => {
let proxy: Proxy
let proxyPort: number
beforeAll((done) => {
// setup HTTP proxy server
proxy = Proxy();
proxy.listen(() => {
proxyPort = proxy.address().port;
done();
});
});
afterAll((done) => {
proxy.once('close', done);
proxy.close();
});
it('should not throw an error if strictSsl is set to false', async () => {
const url = 'https://self-signed.badssl.com'
const agent: any = getProxyAgent(url, {
httpsProxy: `http://127.0.0.1:${proxyPort}`,
strictSsl: false,
})
await fetch(url, { agent })
})
it('should throw an error if strictSsl is not set', async () => {
const url = 'https://self-signed.badssl.com'
const agent: any = getProxyAgent(url, {
httpsProxy: `http://127.0.0.1:${proxyPort}`,
strictSsl: true,
})
await expect(fetch(url, { agent })).rejects.toThrow(/self[- ]signed certificate/)
})
})

0 comments on commit 451e81f

Please sign in to comment.