Skip to content

Commit

Permalink
fix: typos
Browse files Browse the repository at this point in the history
  • Loading branch information
fengkx committed Jan 8, 2024
1 parent 0d0b563 commit 7d40cad
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/agent.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('no proxy is set', () => {
});

describe('http proxy is set', () => {
const httpProxyCofig: Partial<Config> = {
const httpProxyConfig: Partial<Config> = {
proxy: {
protocol: 'http',
host: '10.0.2.2',
Expand All @@ -36,12 +36,12 @@ describe('http proxy is set', () => {
};
beforeAll(() => {
jest.mock('../source/config', (): { config: Partial<Config> } => ({
config: httpProxyCofig
config: httpProxyConfig
}));
});
test('actually mocked', async () => {
const { config } = await import('../source/config');
expect(config).toEqual(httpProxyCofig);
expect(config).toEqual(httpProxyConfig);
});
test('should have proxyUrl set', async () => {
const { proxyUrl } = await import('../source/utils/agent');
Expand All @@ -53,7 +53,7 @@ describe('http proxy is set', () => {
});

describe('https proxy is set', () => {
const httpsProxyCofig: Partial<Config> = {
const httpsProxyConfig: Partial<Config> = {
proxy: {
protocol: 'https',
host: '10.0.2.2',
Expand All @@ -62,12 +62,12 @@ describe('https proxy is set', () => {
};
beforeAll(() => {
jest.mock('../source/config', (): { config: Partial<Config> } => ({
config: httpsProxyCofig
config: httpsProxyConfig
}));
});
test('actually mocked', async () => {
const { config } = await import('../source/config');
expect(config).toEqual(httpsProxyCofig);
expect(config).toEqual(httpsProxyConfig);
});
test('agent should contain http and https', async () => {
const { proxyUrl, default: agent } = await import(
Expand All @@ -76,11 +76,11 @@ describe('https proxy is set', () => {
expect(proxyUrl).toBe('https://10.0.2.2:1080');
expect(agent.http).toHaveProperty(
'proxyOptions.host',
httpsProxyCofig.proxy.host
httpsProxyConfig.proxy.host
);
expect(agent.http).toHaveProperty(
'proxyOptions.port',
parseInt(httpsProxyCofig.proxy.port)
parseInt(httpsProxyConfig.proxy.port)
);
expect(agent.http).toHaveProperty('keepAlive', true);
expect(agent.https).toHaveProperty('keepAlive', true);
Expand Down

0 comments on commit 7d40cad

Please sign in to comment.