Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nicodecleyre committed Sep 1, 2023
1 parent 14865ac commit 1eea5b2
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/request.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ClientRequest } from 'http';
import * as https from 'https';
import * as sinon from 'sinon';
import auth, { CloudType } from './Auth';
import type * as Configstore from 'configstore';
import { Logger } from './cli/Logger';
import _request, { CliRequestOptions } from './request';
import { sinonUtil } from './utils/sinonUtil';
Expand Down Expand Up @@ -398,11 +397,11 @@ describe('Request', () => {
});

it('returns response of a successful GET request, with a proxy url', (done) => {
const config = Cli.getInstance().config as Configstore;
const config = Cli.getInstance().config;
sinon.stub(config, 'get').callsFake(() => 'http://proxy.contoso.com:8080');

sinon.stub(_request as any, 'req').callsFake((options) => {
_options = options;
_options = options as CliRequestOptions;
return Promise.resolve({ data: {} });
});

Expand All @@ -418,11 +417,11 @@ describe('Request', () => {
});

it('returns response of a successful GET request, with a proxy url and defaults port to 80', (done) => {
const config = Cli.getInstance().config as Configstore;
const config = Cli.getInstance().config;
sinon.stub(config, 'get').callsFake(() => 'http://proxy.contoso.com');

sinon.stub(_request as any, 'req').callsFake((options) => {
_options = options;
_options = options as CliRequestOptions;
return Promise.resolve({ data: {} });
});

Expand All @@ -438,11 +437,11 @@ describe('Request', () => {
});

it('returns response of a successful GET request, with a proxy url and defaults port to 443', (done) => {
const config = Cli.getInstance().config as Configstore;
const config = Cli.getInstance().config;
sinon.stub(config, 'get').callsFake(() => 'https://proxy.contoso.com');

sinon.stub(_request as any, 'req').callsFake((options) => {
_options = options;
_options = options as CliRequestOptions;
return Promise.resolve({ data: {} });
});

Expand All @@ -458,11 +457,11 @@ describe('Request', () => {
});

it('returns response of a successful GET request, with a proxy url with username and password', (done) => {
const config = Cli.getInstance().config as Configstore;
const config = Cli.getInstance().config;
sinon.stub(config, 'get').callsFake(() => 'http://username:password@proxy.contoso.com:8080');

sinon.stub(_request as any, 'req').callsFake((options) => {
_options = options;
_options = options as CliRequestOptions;
return Promise.resolve({ data: {} });
});

Expand Down

0 comments on commit 1eea5b2

Please sign in to comment.