First set of test for SchemaCompareDialog (#11444)

* Add a test for SchemaCompareDialog and update the product code with deferred promise

* Update test to verify that button clicked worked

* Addressed comments

* Updated verifyButtonsState to use should instead of console.log
This commit is contained in:
Sakshi Sharma
2020-08-04 01:10:46 -07:00
committed by GitHub
parent eeb1f7cf3e
commit 381a32929f
6 changed files with 262 additions and 148 deletions

View File

@@ -9,6 +9,7 @@ import * as mssql from '../../mssql';
import * as os from 'os';
import * as loc from './localizedConstants';
import { ApiWrapper } from './common/apiWrapper';
import { promises as fs } from 'fs';
export interface IPackageInfo {
name: string;
@@ -84,7 +85,7 @@ function connectionInfoToConnectionProfile(details: azdata.ConnectionInfo): azda
};
}
export async function verifyConnectionAndGetOwnerUri(endpoint: mssql.SchemaCompareEndpointInfo, caller: string, apiWrapper: ApiWrapper): Promise<string> {
export async function verifyConnectionAndGetOwnerUri(endpoint: mssql.SchemaCompareEndpointInfo, caller: string, apiWrapper: ApiWrapper): Promise<string | undefined> {
let ownerUri = undefined;
if (endpoint.endpointType === mssql.SchemaCompareEndpointType.Database && endpoint.connectionDetails) {
@@ -132,3 +133,12 @@ export async function verifyConnectionAndGetOwnerUri(endpoint: mssql.SchemaCompa
export function getRootPath(): string {
return vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0].uri.fsPath : os.homedir();
}
export async function exists(path: string): Promise<boolean> {
try {
await fs.access(path);
return true;
} catch (e) {
return false;
}
}