Add more arc tests (#11145)

* Add more arc tests

* Update comment
This commit is contained in:
Charles Gagnon
2020-06-30 14:05:27 -07:00
committed by GitHub
parent 41315c6e0a
commit a1f600657a
5 changed files with 255 additions and 19 deletions

View File

@@ -103,13 +103,6 @@ export function getDatabaseStateDisplayText(state: string): string {
return state;
}
/**
* Opens an input box prompting the user to enter in the name of a resource to delete
* @param namespace The namespace of the resource to delete
* @param name The name of the resource to delete
* @returns Promise resolving to true if the user confirmed the name, false if the input box was closed for any other reason
*/
/**
* Opens an input box prompting and validating the user's input.
* @param options Options for the input box
@@ -173,9 +166,9 @@ export async function promptForResourceDeletion(namespace: string, name: string)
* Opens an input box prompting the user to enter and confirm a password
* @param validate A function that accepts the password and returns an error message if it's invalid
* @returns Promise resolving to the password if it passed validation,
* or false if the input box was closed for any other reason
* or undefined if the input box was closed for any other reason
*/
export async function promptAndConfirmPassword(validate: (input: string) => string): Promise<string | false> {
export async function promptAndConfirmPassword(validate: (input: string) => string): Promise<string | undefined> {
const title = loc.resetPassword;
const options: vscode.InputBoxOptions = {
prompt: loc.enterNewPassword,
@@ -190,7 +183,7 @@ export async function promptAndConfirmPassword(validate: (input: string) => stri
return promptInputBox(title, options);
}
return false;
return undefined;
}
/**
@@ -198,7 +191,7 @@ export async function promptAndConfirmPassword(validate: (input: string) => stri
* @param error The error object
*/
export function getErrorMessage(error: any): string {
if (error?.body?.reason) {
if (error.body?.reason) {
// For HTTP Errors with a body pull out the reason message since that's usually the most helpful
return error.body.reason;
} else if (error.message) {