Un-skip and fix a few of the db projects tests (#13726)

* Un-skip and fix a few of the db projects tests

* Addressed comments

* Fix one test failure on Linux/Mac
This commit is contained in:
Sakshi Sharma
2020-12-10 09:50:49 -08:00
committed by GitHub
parent 515b0794b0
commit 254ecc4123
6 changed files with 42 additions and 36 deletions

View File

@@ -8,20 +8,25 @@ import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';
import * as vscode from 'vscode';
import * as sinon from 'sinon';
import { NetCoreTool, DBProjectConfigurationKey, NetCoreInstallLocationKey, NextCoreNonWindowsDefaultPath } from '../tools/netcoreTool';
import { getQuotedPath } from '../common/utils';
import { isNullOrUndefined } from 'util';
import { generateTestFolderPath } from './testUtils';
describe.skip('NetCoreTool: Net core tests', function (): void {
describe('NetCoreTool: Net core tests', function (): void {
afterEach(function (): void {
sinon.restore();
});
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();
sinon.stub(netcoreTool, 'showInstallDialog').returns(Promise.resolve());
should(netcoreTool.netcoreInstallLocation).equal('test value path'); // the path in settings should be taken
should(netcoreTool.findOrInstallNetCore()).equal(false); // dotnet can not be present at dummy path in settings
should(await netcoreTool.findOrInstallNetCore()).equal(false); // dotnet can not be present at dummy path in settings
}
finally {
// clean again
@@ -29,9 +34,10 @@ describe.skip('NetCoreTool: Net core tests', function (): void {
}
});
it('Should find right dotnet default paths', function (): void {
it('Should find right dotnet default paths', async function (): Promise<void> {
const netcoreTool = new NetCoreTool();
netcoreTool.findOrInstallNetCore();
sinon.stub(netcoreTool, 'showInstallDialog').returns(Promise.resolve());
await netcoreTool.findOrInstallNetCore();
if (os.platform() === 'win32') {
// check that path should start with c:\program files