Cleanup generated test files and folders for Sql DB projects (#20862)

* Cleanup generated test files and folders

* Add await to fix tests
This commit is contained in:
Sakshi Sharma
2022-10-21 13:00:03 -07:00
committed by GitHub
parent 8acda681b4
commit 2a2ac74032
14 changed files with 97 additions and 10 deletions

View File

@@ -30,6 +30,10 @@ describe('Project: sqlproj content operations', function (): void {
projFilePath = await testUtils.createTestSqlProjFile(baselines.openProjectFileBaseline);
});
after(async function(): Promise<void> {
await testUtils.deleteGeneratedTestFolder();
});
it('Should read Project from sqlproj', async function (): Promise<void> {
const project: Project = await Project.openProject(projFilePath);
@@ -914,6 +918,10 @@ describe('Project: sdk style project content operations', function (): void {
sinon.restore();
});
after(async function(): Promise<void> {
await testUtils.deleteGeneratedTestFolder();
});
it('Should read project from sqlproj and files and folders by globbing', async function (): Promise<void> {
projFilePath = await testUtils.createTestSqlProjFile(baselines.openSdkStyleSqlProjectBaseline);
await testUtils.createDummyFileStructureWithPrePostDeployScripts(false, undefined, path.dirname(projFilePath));
@@ -1551,6 +1559,7 @@ describe('Project: sdk style project content operations', function (): void {
should(project.files.find(f => f.type === EntryType.File && f.relativePath === externalFileRelativePath)).not.equal(undefined);
projFileText = (await fs.readFile(projFilePath)).toString();
should(projFileText.includes(`<Build Include="${externalFileRelativePath}" />`)).equal(true, projFileText);
await fs.rm(externalSqlFile);
});
});
@@ -1559,6 +1568,10 @@ describe('Project: add SQLCMD Variables', function (): void {
await baselines.loadBaselines();
});
after(async function(): Promise<void> {
await testUtils.deleteGeneratedTestFolder();
});
it('Should update .sqlproj with new sqlcmd variables', async function (): Promise<void> {
projFilePath = await testUtils.createTestSqlProjFile(baselines.openProjectFileBaseline);
const project = await Project.openProject(projFilePath);
@@ -1584,6 +1597,10 @@ describe('Project: properties', function (): void {
await baselines.loadBaselines();
});
after(async function(): Promise<void> {
await testUtils.deleteGeneratedTestFolder();
});
it('Should read target database version', async function (): Promise<void> {
projFilePath = await testUtils.createTestSqlProjFile(baselines.openProjectFileBaseline);
const project = await Project.openProject(projFilePath);
@@ -1749,6 +1766,10 @@ describe('Project: round trip updates', function (): void {
sinon.restore();
});
after(async function(): Promise<void> {
await testUtils.deleteGeneratedTestFolder();
});
it('Should update SSDT project to work in ADS', async function (): Promise<void> {
await testUpdateInRoundTrip(baselines.SSDTProjectFileBaseline, baselines.SSDTProjectAfterUpdateBaseline);
});
@@ -1836,6 +1857,10 @@ describe('Project: legacy to SDK-style updates', function (): void {
sinon.restore();
});
after(async function(): Promise<void> {
await testUtils.deleteGeneratedTestFolder();
});
it('Should update legacy style project to SDK-style', async function (): Promise<void> {
const projFilePath = await testUtils.createTestSqlProjFile(baselines.newProjectFileBaseline);
const list: Uri[] = [];