mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 09:35:39 -05:00
Make Create Azure Function with SQL Binding more efficient and simple (#19187)
* initial refactor * fix projectFolder cases * update create azure function with sql binding when no folder is opened * corner case exit browse file * add version since targetFramework is set to specific core tools version * update telemetry and address comments * use project folder instead
This commit is contained in:
@@ -12,7 +12,6 @@ import * as azureFunctionsUtils from '../../common/azureFunctionsUtils';
|
||||
|
||||
const rootFolderPath = 'test';
|
||||
const localSettingsPath: string = path.join(rootFolderPath, 'local.settings.json');
|
||||
const projectFilePath: string = path.join(rootFolderPath, 'projectFilePath.csproj');
|
||||
|
||||
describe('Tests to verify Azure Functions Utils functions', function (): void {
|
||||
|
||||
@@ -55,7 +54,7 @@ describe('Tests to verify Azure Functions Utils functions', function (): void {
|
||||
});
|
||||
|
||||
it('Should get settings file given project file', async () => {
|
||||
const settingsFile = await azureFunctionsUtils.getSettingsFile(projectFilePath);
|
||||
const settingsFile = await azureFunctionsUtils.getSettingsFile(rootFolderPath);
|
||||
should(settingsFile).equals(localSettingsPath);
|
||||
});
|
||||
|
||||
@@ -68,7 +67,7 @@ describe('Tests to verify Azure Functions Utils functions', function (): void {
|
||||
const connectionString = 'testConnectionString';
|
||||
|
||||
let writeFileStub = sinon.stub(fs.promises, 'writeFile');
|
||||
await azureFunctionsUtils.addConnectionStringToConfig(connectionString, projectFilePath);
|
||||
await azureFunctionsUtils.addConnectionStringToConfig(connectionString, rootFolderPath);
|
||||
should(writeFileStub.calledWithExactly(localSettingsPath, `{\n "IsEncrypted": false,\n "Values": {\n "test1": "test1",\n "test2": "test2",\n "test3": "test3",\n "SqlConnectionString": "testConnectionString"\n }\n}`)).equals(true);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user