-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vscode): Fix designtime local.settings overwriting (#4983)
* Add function to get local.settings schema * Add test for local settings schema * Redirect import to node_modules
- Loading branch information
1 parent
8cf13cd
commit b010740
Showing
12 changed files
with
161 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
apps/vs-code-designer/src/app/utils/appSettings/__test__/localSettings.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { describe, it, expect, vi } from 'vitest'; | ||
import { getLocalSettingsSchema } from '../localSettings'; | ||
import { | ||
ProjectDirectoryPath, | ||
appKindSetting, | ||
azureStorageTypeSetting, | ||
azureWebJobsSecretStorageTypeKey, | ||
azureWebJobsStorageKey, | ||
localEmulatorConnectionString, | ||
workerRuntimeKey, | ||
} from '../../../../constants'; | ||
|
||
describe('utils/appSettings', () => { | ||
describe('getLocalSettingsSchema', () => { | ||
const projectPath = 'path/to/project'; | ||
|
||
it('Should have IsEncrypted property and Values property have basic schema', () => { | ||
const settings = getLocalSettingsSchema(true); | ||
expect(settings).toHaveProperty('IsEncrypted', false); | ||
expect(settings).toHaveProperty('Values'); | ||
expect(settings['Values']).toHaveProperty(appKindSetting); | ||
expect(settings['Values']).toHaveProperty(workerRuntimeKey); | ||
}); | ||
|
||
it('Should not have ProjectDirectoryPath when project path param is not sent', () => { | ||
const settings = getLocalSettingsSchema(true); | ||
expect(settings).not.toHaveProperty(ProjectDirectoryPath); | ||
}); | ||
|
||
it('Should have the AzureWebJobsSecretStorageType when is design time localsettings and have ProjectDirectoryPath property when sent', () => { | ||
const settings = getLocalSettingsSchema(true, projectPath); | ||
expect(settings['Values']).toHaveProperty(azureWebJobsSecretStorageTypeKey, azureStorageTypeSetting); | ||
expect(settings['Values']).toHaveProperty(ProjectDirectoryPath, projectPath); | ||
}); | ||
|
||
it('Should have the AzureWebJobsStorage when is not design time localsettings and have ProjectDirectoryPath property when sent', () => { | ||
const settings = getLocalSettingsSchema(false, projectPath); | ||
expect(settings['Values']).toHaveProperty(azureWebJobsStorageKey, localEmulatorConnectionString); | ||
expect(settings['Values']).toHaveProperty(ProjectDirectoryPath, projectPath); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.