mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
Feature/project build (#10332)
* initial build command execution * adding tests * Clean up test names * update SqltoolsService release in ADS for Build * Updating as per PR comments * updating yarn lock * Adding one more test for command run * Test fixes
This commit is contained in:
@@ -5,19 +5,23 @@
|
||||
|
||||
import * as should from 'should';
|
||||
import * as os from 'os';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import { NetCoreTool, DBProjectConfigurationKey, NetCoreInstallLocationKey, NextCoreNonWindowsDefaultPath } from '../tools/netcoreTool';
|
||||
import { getSafePath } from '../common/utils';
|
||||
import { isNullOrUndefined } from 'util';
|
||||
import { generateTestFolderPath } from './testUtils';
|
||||
|
||||
describe('NetCoreTool: Net core install popup tests', function (): void {
|
||||
describe('NetCoreTool: Net core tests', function (): void {
|
||||
|
||||
it('settings value should override default paths', async function (): Promise<void> {
|
||||
it('Should override dotnet default value with settings', async function (): Promise<void> {
|
||||
try {
|
||||
// update settings and validate
|
||||
await vscode.workspace.getConfiguration(DBProjectConfigurationKey).update(NetCoreInstallLocationKey, 'test value path', true);
|
||||
const netcoreTool = new NetCoreTool();
|
||||
should(netcoreTool.netcoreInstallLocation).equal('test value path'); // the path in settings should be taken
|
||||
should(netcoreTool.isNetCoreInstallationPresent).equal(false); // dotnet can not be present at dummy path in settings
|
||||
should(netcoreTool.findOrInstallNetCore()).equal(false); // dotnet can not be present at dummy path in settings
|
||||
}
|
||||
finally {
|
||||
// clean again
|
||||
@@ -25,7 +29,7 @@ describe('NetCoreTool: Net core install popup tests', function (): void {
|
||||
}
|
||||
});
|
||||
|
||||
it('should find right default paths', async function (): Promise<void> {
|
||||
it('Should find right dotnet default paths', async function (): Promise<void> {
|
||||
const netcoreTool = new NetCoreTool();
|
||||
netcoreTool.findOrInstallNetCore();
|
||||
|
||||
@@ -41,8 +45,23 @@ describe('NetCoreTool: Net core install popup tests', function (): void {
|
||||
should(result).true('dotnet is either not present or in /usr/local/share by default');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
export async function sleep(ms: number): Promise<{}> {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
it('should run a command successfully', async function (): Promise<void> {
|
||||
const netcoreTool = new NetCoreTool();
|
||||
const dummyFile = path.join(await generateTestFolderPath(), 'dummy.dacpac');
|
||||
const outputChannel = vscode.window.createOutputChannel('db project test');
|
||||
|
||||
try {
|
||||
await netcoreTool.runStreamedCommand('echo test > ' + getSafePath(dummyFile), outputChannel, undefined);
|
||||
const text = await fs.promises.readFile(dummyFile);
|
||||
should(text.toString().trim()).equal('test');
|
||||
}
|
||||
finally {
|
||||
await fs.exists(dummyFile, async (existBool) => {
|
||||
if (existBool) {
|
||||
await fs.promises.unlink(dummyFile);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user