mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 09:35:38 -05:00
fix flaky data workspace test (#13965)
This commit is contained in:
@@ -8,7 +8,7 @@ import * as TypeMoq from 'typemoq';
|
||||
import * as sinon from 'sinon';
|
||||
import * as vscode from 'vscode';
|
||||
import * as constants from '../../common/constants';
|
||||
import { promises as fs } from 'fs';
|
||||
import * as utils from '../../common/utils';
|
||||
import { WorkspaceService } from '../../services/workspaceService';
|
||||
import { OpenExistingDialog } from '../../dialogs/openExistingDialog';
|
||||
import { createProjectFile, generateUniqueProjectFilePath, generateUniqueWorkspaceFilePath, testProjectType } from '../testUtils';
|
||||
@@ -47,16 +47,16 @@ suite('Open Existing Dialog', function (): void {
|
||||
|
||||
dialog._targetTypeRadioCardGroup?.updateProperty( 'selectedCardId', constants.Workspace);
|
||||
dialog._filePathTextBox!.value = 'nonExistentWorkspaceFile';
|
||||
const fileExistStub = sinon.stub(utils, 'fileExist').resolves(false);
|
||||
|
||||
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
|
||||
// validation should pass if workspace file exists
|
||||
dialog._filePathTextBox!.value = generateUniqueWorkspaceFilePath();
|
||||
await fs.writeFile(dialog._filePathTextBox!.value , '');
|
||||
fileExistStub.resolves(true);
|
||||
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