Skip to content

Commit b62073c

Browse files
committed
test: url with port
1 parent b827245 commit b62073c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/unit/status/myDomainResolver.test.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ describe('myDomainResolver', () => {
2020
const TEST_IP = '1.1.1.1';
2121
const CALL_COUNT = 3;
2222

23-
let lookupAsyncSpy: { callCount: number };
23+
let lookupAsyncSpy: sinon.SinonStub;
24+
2425
beforeEach(() => {
2526
lookupAsyncSpy = $$.SANDBOX.stub(dns, 'lookup').callsFake((host: string, callback: AnyFunction) => {
2627
const isDefaultHost = host === MyDomainResolver.DEFAULT_DOMAIN.host;
@@ -45,6 +46,17 @@ describe('myDomainResolver', () => {
4546
expect(lookupAsyncSpy.callCount).to.be.equal(CALL_COUNT);
4647
});
4748

49+
it('should do lookup without port', async () => {
50+
const options: MyDomainResolver.Options = {
51+
url: new URL(`https://${POSITIVE_HOST}:6101`),
52+
};
53+
const resolver: MyDomainResolver = await MyDomainResolver.create(options);
54+
const ip = await resolver.resolve();
55+
expect(ip).to.be.equal(TEST_IP);
56+
// verify that it uses hostname (without port) not host
57+
expect(lookupAsyncSpy.args[0][0]).to.be.equal(POSITIVE_HOST);
58+
});
59+
4860
describe('disable dns check', () => {
4961
const env = new Env();
5062
it('should return host if SFDX_DISABLE_DNS_CHECK is set to true', async () => {

0 commit comments

Comments
 (0)