mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-15 17:22:25 -05:00
Enable sql-database-projects tests with few fixes (#10610)
* Added 2tests related to import. Fixed a few issues. Enable sql-database-projects * Addressed comment
This commit is contained in:
@@ -14,7 +14,7 @@ import { Project, EntryType } from '../models/project';
|
||||
let projFilePath: string;
|
||||
|
||||
describe('Project: sqlproj content operations', function (): void {
|
||||
before(async function () : Promise<void> {
|
||||
before(async function() : Promise<void> {
|
||||
await baselines.loadBaselines();
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ describe('Project: sqlproj content operations', function (): void {
|
||||
|
||||
const newFileContents = (await fs.readFile(path.join(newProject.projectFolderPath, filePath))).toString();
|
||||
|
||||
should (newFileContents).equal(fileContents);
|
||||
should(newFileContents).equal(fileContents);
|
||||
});
|
||||
|
||||
it('Should add Folder and Build entries to sqlproj with pre-existing scripts on disk', async function (): Promise<void> {
|
||||
@@ -65,6 +65,20 @@ describe('Project: sqlproj content operations', function (): void {
|
||||
await project.addToProject(list);
|
||||
|
||||
should(project.files.filter(f => f.type === EntryType.File).length).equal(11); // txt file shouldn't be added to the project
|
||||
should(project.files.filter(f => f.type === EntryType.Folder).length).equal(3); // 2folders + default Properties folder
|
||||
should(project.files.filter(f => f.type === EntryType.Folder).length).equal(3); // 2folders + default Properties folder
|
||||
});
|
||||
|
||||
it('Should throw error while adding Folder and Build entries to sqlproj when a file/folder does not exist on disk', async function (): Promise<void> {
|
||||
projFilePath = await testUtils.createTestSqlProjFile(baselines.newProjectFileBaseline);
|
||||
const project = new Project(projFilePath);
|
||||
await project.readProjFile();
|
||||
|
||||
let list: string[] = [];
|
||||
let testFolderPath: string = await testUtils.createDummyFileStructure(true, list, path.dirname(projFilePath));
|
||||
|
||||
const nonexistentFile = path.join(testFolderPath, 'nonexistentFile.sql');
|
||||
list.push(nonexistentFile);
|
||||
|
||||
await testUtils.shouldThrowSpecificError(async () => await project.addToProject(list), `ENOENT: no such file or directory, stat \'${nonexistentFile}\'`);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user