mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 03:58:33 -05:00
Additional tests for the import wizard (#11273)
* Setting up tests on import extension * -Added API wrappers for all the azdata and vscode APIs to make them easily mockable -Added some unit tests for the import extension -Some code logic separations * -added code report for the import extension in ci * Did some more code refractoring * -Added json report generation * updated vscodetestcoverage to latest version in import extension. * -remove duplicate codecoverageConfig.json * -Added some modifyColumnPage tests * pushing temp changes * -Added some more testcases * -Added tests using available vscode and azdata apis * some minor comment change * removed unnecessary test * added accidently removed test * Added some comments * fixed some broken tests and added comments in fileConfigPage * code clean up and some more comments * fixed the prosePreviewPage test and the download test * added getter and setters * Increasing timeout and fixing a comment * removed unnecessary comments and some other code cleanup * Deleting dotnet files before redownloading them * - made changes in the PR - Moved extensioncode to utils.test for better reusability * added some 'should' messages
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import { ImportDataModel, ColumnMetadata } from '../wizard/api/models';
|
||||
import { FlatFileProvider, PROSEDiscoveryParams, InsertDataParams, GetColumnInfoParams, ChangeColumnSettingsParams, PROSEDiscoveryResponse, InsertDataResponse, ChangeColumnSettingsResponse, GetColumnInfoResponse } from '../services/contracts';
|
||||
import * as fs from 'fs';
|
||||
|
||||
export class ImportTestUtils {
|
||||
|
||||
@@ -34,6 +36,22 @@ export class ImportTestUtils {
|
||||
options: {}
|
||||
} as azdata.connection.ConnectionProfile;
|
||||
}
|
||||
|
||||
public static async checkPathExists(path: string): Promise<boolean> {
|
||||
return fs.promises.access(path, fs.constants.F_OK)
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
}
|
||||
|
||||
public static async getExtensionPath(): Promise<string> {
|
||||
return await vscode.extensions.getExtension('Microsoft.import').extensionPath;
|
||||
}
|
||||
|
||||
public static async getTestExtensionContext(): Promise<TestExtensionContext> {
|
||||
let testContext = new TestExtensionContext();
|
||||
testContext.extensionPath = await vscode.extensions.getExtension('Microsoft.import').extensionPath;
|
||||
return testContext;
|
||||
}
|
||||
}
|
||||
|
||||
export class TestQueryProvider implements azdata.QueryProvider {
|
||||
@@ -211,3 +229,20 @@ export class TestImportDataModel implements ImportDataModel {
|
||||
filePath: string;
|
||||
fileType: string;
|
||||
}
|
||||
|
||||
export class TestFlatFileProvider implements FlatFileProvider {
|
||||
providerId?: string;
|
||||
sendPROSEDiscoveryRequest(params: PROSEDiscoveryParams): Thenable<PROSEDiscoveryResponse> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
sendInsertDataRequest(params: InsertDataParams): Thenable<InsertDataResponse> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
sendGetColumnInfoRequest(params: GetColumnInfoParams): Thenable<GetColumnInfoResponse> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
sendChangeColumnSettingsRequest(params: ChangeColumnSettingsParams): Thenable<ChangeColumnSettingsResponse> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user