Add a few unit tests for dacpac extension (#9194)

* add a few unit tests

* fix tests for linux
This commit is contained in:
Kim Santiago
2020-02-24 10:01:30 -08:00
committed by GitHub
parent 10b681b3c8
commit 9090143f9d
9 changed files with 247 additions and 136 deletions

View File

@@ -12,7 +12,7 @@ export abstract class BasePage {
protected readonly wizardPage: azdata.window.WizardPage;
protected readonly model: DacFxDataModel;
protected readonly view: azdata.ModelView;
protected databaseValues: string[];
public databaseValues: string[];
/**
* This method constructs all the elements of the page.

View File

@@ -207,7 +207,7 @@ export abstract class DacFxConfigPage extends BasePage {
}
// Compares database name with existing databases on the server
protected databaseNameExists(n: string): boolean {
public databaseNameExists(n: string): boolean {
for (let i = 0; i < this.databaseValues.length; ++i) {
if (this.databaseValues[i].toLowerCase() === n.toLowerCase()) {
// database name exists

View File

@@ -120,7 +120,7 @@ export function isValidBasenameErrorMessage(name: string | null | undefined): st
}
if (basename === '.' || basename === '..') {
return loc.reservedWindowsFilenameErrorMessage; // check for reserved values
return loc.reservedValueErrorMessage; // check for reserved values
}
if (isWindows && basename.length !== basename.trim().length) {
@@ -133,3 +133,7 @@ export function isValidBasenameErrorMessage(name: string | null | undefined): st
return '';
}
export function generateDatabaseName(filePath: string): string {
return path.parse(filePath).name;
}