Removing ApiWrapper and adding sinon (#11340)

* Added sinon
removed api wrapper
removed unnecesaary utils

* merged from testfix

* merged from aasim/import/downloadTestFix

* merge from aasim/import/downloadTestFix
This commit is contained in:
Aasim Khan
2020-07-14 14:53:18 -07:00
committed by GitHub
parent cabbbb56f2
commit 24f6cd2e5b
19 changed files with 212 additions and 322 deletions

View File

@@ -5,14 +5,12 @@
import * as azdata from 'azdata';
import { ImportDataModel } from './models';
import { ApiWrapper } from '../../common/apiWrapper';
export abstract class BasePage {
protected readonly wizardPage: azdata.window.WizardPage;
protected readonly model: ImportDataModel;
protected readonly view: azdata.ModelView;
protected _apiWrapper: ApiWrapper;
/**
* This method constructs all the elements of the page.
@@ -45,7 +43,7 @@ export abstract class BasePage {
public abstract setupNavigationValidator(): void;
public async getServerValues(): Promise<{ connection: azdata.connection.Connection, displayName: string, name: string }[]> {
let cons = await this._apiWrapper.getActiveConnections();
let cons = await azdata.connection.getActiveConnections();
// This user has no active connections ABORT MISSION
if (!cons || cons.length === 0) {
return undefined;
@@ -95,7 +93,7 @@ export abstract class BasePage {
public async getDatabaseValues(): Promise<{ displayName: string, name: string }[]> {
let idx = -1;
let count = -1;
let values = (await this._apiWrapper.listDatabases(this.model.server.connectionId)).map(db => {
let values = (await azdata.connection.listDatabases(this.model.server.connectionId)).map(db => {
count++;
if (this.model.database && db === this.model.database) {
idx = count;

View File

@@ -8,7 +8,6 @@ import * as azdata from 'azdata';
import { FlatFileProvider } from '../../services/contracts';
import { FlatFileWizard } from '../flatFileWizard';
import { BasePage } from './basePage';
import { ApiWrapper } from '../../common/apiWrapper';
export abstract class ImportPage extends BasePage {
@@ -19,13 +18,12 @@ export abstract class ImportPage extends BasePage {
protected readonly provider: FlatFileProvider;
constructor(instance: FlatFileWizard, wizardPage: azdata.window.WizardPage, model: ImportDataModel, view: azdata.ModelView, provider: FlatFileProvider, apiWrapper: ApiWrapper) {
constructor(instance: FlatFileWizard, wizardPage: azdata.window.WizardPage, model: ImportDataModel, view: azdata.ModelView, provider: FlatFileProvider) {
super();
this.instance = instance;
this.wizardPage = wizardPage;
this.model = model;
this.view = view;
this.provider = provider;
this._apiWrapper = apiWrapper;
}
}