mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 17:23:25 -05:00
Preserve error messages if workspace validation fails in tests (#13901)
* preserving error messages if test fails * change name of var to due scope change
This commit is contained in:
@@ -26,14 +26,18 @@ suite('Open Existing Dialog', function (): void {
|
||||
await dialog.open();
|
||||
|
||||
dialog._targetTypeRadioCardGroup?.updateProperty( 'selectedCardId', constants.Project);
|
||||
dialog._filePathTextBox!.value = '';
|
||||
dialog._filePathTextBox!.value = 'nonExistentProjectFile';
|
||||
dialog.workspaceInputBox!.value = 'test.code-workspace';
|
||||
|
||||
should.equal(await dialog.validate(), false, 'Validation fail because project file does not exist');
|
||||
const validateResult = await dialog.validate();
|
||||
|
||||
const msg = constants.FileNotExistError('project', 'nonExistentProjectFile');
|
||||
should.equal(dialog.dialogObject.message.text, msg);
|
||||
should.equal(validateResult, false, 'Validation should fail because project file does not exist, but passed');
|
||||
|
||||
// create a project file
|
||||
dialog._filePathTextBox!.value = await createProjectFile('testproj');
|
||||
should.equal(await dialog.validate(), true, 'Validation pass because project file exists');
|
||||
should.equal(await dialog.validate(), true, `Validation should pass because project file exists, but failed with: ${dialog.dialogObject.message.text}`);
|
||||
});
|
||||
|
||||
test('Should validate workspace file exists', async function (): Promise<void> {
|
||||
@@ -42,13 +46,18 @@ suite('Open Existing Dialog', function (): void {
|
||||
await dialog.open();
|
||||
|
||||
dialog._targetTypeRadioCardGroup?.updateProperty( 'selectedCardId', constants.Workspace);
|
||||
dialog._filePathTextBox!.value = '';
|
||||
should.equal(await dialog.validate(), false, 'Validation fail because workspace file does not exist');
|
||||
dialog._filePathTextBox!.value = 'nonExistentWorkspaceFile';
|
||||
|
||||
const validateResult = await dialog.validate();
|
||||
|
||||
const msg = constants.FileNotExistError('workspace', 'nonExistentWorkspaceFile');
|
||||
should.equal(dialog.dialogObject.message.text, msg);
|
||||
should.equal(validateResult, false, 'Validation should fail because workspace file does not exist, but passed');
|
||||
|
||||
// create a workspace file
|
||||
dialog._filePathTextBox!.value = generateUniqueWorkspaceFilePath();
|
||||
await fs.writeFile(dialog._filePathTextBox!.value , '');
|
||||
should.equal(await dialog.validate(), true, 'Validation pass because workspace file exists');
|
||||
should.equal(await dialog.validate(), true, `Validation should pass because workspace file exists, but failed with: ${dialog.dialogObject.message.text}`);
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user