Add external miaa endpoint property (#11940)

This commit is contained in:
Charles Gagnon
2020-08-24 18:07:25 -07:00
committed by GitHub
parent 54826b5fe3
commit 969932743a
6 changed files with 59 additions and 29 deletions

View File

@@ -6,7 +6,7 @@
import * as vscode from 'vscode';
import * as should from 'should';
import 'mocha';
import { resourceTypeToDisplayName, parseEndpoint, parseInstanceName, getAzurecoreApi, getResourceTypeIcon, getConnectionModeDisplayText, getDatabaseStateDisplayText, promptForResourceDeletion, promptAndConfirmPassword, getErrorMessage } from '../../common/utils';
import { resourceTypeToDisplayName, parseEndpoint, parseInstanceName, getAzurecoreApi, getResourceTypeIcon, getConnectionModeDisplayText, getDatabaseStateDisplayText, promptForResourceDeletion, promptAndConfirmPassword, getErrorMessage, parseIpAndPort } from '../../common/utils';
import * as loc from '../../localizedConstants';
import { ResourceType, IconPathHelper, ConnectionMode as ConnectionMode } from '../../constants';
@@ -185,7 +185,7 @@ describe('promptAndConfirmPassword Method Tests', function (): void {
}
});
mockInputBox.value = password;
mockInputBox.triggerAccept().then( () => {
mockInputBox.triggerAccept().then(() => {
mockInputBox.value = password;
mockInputBox.triggerAccept();
});
@@ -212,7 +212,7 @@ describe('promptAndConfirmPassword Method Tests', function (): void {
}
});
mockInputBox.value = password;
mockInputBox.triggerAccept().then( () => {
mockInputBox.triggerAccept().then(() => {
mockInputBox.hide();
});
});
@@ -221,8 +221,8 @@ describe('promptAndConfirmPassword Method Tests', function (): void {
const testError = 'Test Error';
promptAndConfirmPassword((_: string) => { return testError; }).catch(err => done(err));
mockInputBox.value = '';
mockInputBox.triggerAccept().then( () => {
if(mockInputBox.validationMessage === testError) {
mockInputBox.triggerAccept().then(() => {
if (mockInputBox.validationMessage === testError) {
done();
} else {
done(new Error(`Validation message '${mockInputBox.validationMessage}' was expected to be '${testError}'`));
@@ -233,10 +233,10 @@ describe('promptAndConfirmPassword Method Tests', function (): void {
it('Error message displayed when passwords do not match', function (done): void {
promptAndConfirmPassword((_: string) => { return ''; }).catch(err => done(err));
mockInputBox.value = 'MyPassword';
mockInputBox.triggerAccept().then( () => {
mockInputBox.triggerAccept().then(() => {
mockInputBox.value = 'WrongPassword';
mockInputBox.triggerAccept().then( () => {
if(mockInputBox.validationMessage === loc.thePasswordsDoNotMatch) {
mockInputBox.triggerAccept().then(() => {
if (mockInputBox.validationMessage === loc.thePasswordsDoNotMatch) {
done();
} else {
done(new Error(`Validation message '${mockInputBox.validationMessage} was not the expected message`));
@@ -274,3 +274,16 @@ describe('parseInstanceName Method Tests', function () {
should(() => parseInstanceName('Some_Invalid_Name')).throwError();
});
});
describe('parseIpAndPort', function (): void {
it('Valid address', function (): void {
const ip = '127.0.0.1';
const port = '80';
should(parseIpAndPort(`${ip}:${port}`)).deepEqual({ ip: ip, port: port });
});
it('invalid address - no port', function (): void {
const ip = '127.0.0.1';
should(() => parseIpAndPort(ip)).throwError();
});
});